我有一个使用XML定义的图表,并在我的NavGraph中添加了一个DialogFragment作为其中的一个Fragment。当我调用NavController.navigate方法并提供resId和bundle参数时,我没有看到任何对话框被显示出来。是否有办法使用DialogFragment代替标准的Fragment?
<fragment
android:id="@+id/noLoginDialog"
android:name="com.ram.view.NoLoginDialog"
android:label="NoLoginDialog">
<argument
android:name="argTitle"
android:defaultValue="null"
app:type="string"/>
<argument
android:name="argBody"
android:defaultValue="null"
app:type="string"/>
<argument
android:name="argButton"
android:defaultValue="null"
app:type="string"/>
</fragment>
我的操作定义如下:
<container_fragment
android:id="@+id/homeFragment"
android:name="com.ram.home.HomeFragment"
android:label="HomeFragment">
<action
android:id="@+id/action_homeFragment_to_noAuthAlertDialog"
app:destination="@id/noLoginDialog"/>
</container_fragment>
我对与活动和片段相关的其他操作都能正常工作。