在dialogfragment&带有导航组件的碎片
在上面的导航流中,我在从对话框导航到
到对话框1
堆栈时,我正面临问题 - 因此从对话框1
点击设备返回按钮,然后返回对话框3
,而不是转到fragment
。
<fragment
android:id="@+id/fragment1"
android:name="fragment"
tools:layout="@layout/fragment1" />
<dialog
android:id="dialog1"
android:name="dialog1"
tools:layout="@layout/dialog1" />
<dialog
android:id="@+id/dialog2"
android:name="dialog2"
tools:layout="@layout/dialog2" />
<dialog
android:id="@+id/dialog3"
android:name="dialog3"
tools:layout="@layout/dialog3">
<action
android:id="@+id/actionToDialog1"
app:destination="@id/dialog1"
app:launchSingleTop="true"
app:popUpTo="@id/dialog1"
app:popUpToInclusive="true" />
</dialog>
在设备返回按钮上,我在下面的代码下方
navController.navigate(R.id.actionToDialog1);
,导航正常工作,但是一旦您登陆对话框1
堆栈未清除,它应该转到fragment
而是去。到对话框3
In the above navigation flow, I am facing an issue while navigating from Dialog 3
to Dialog 1
stack is not getting cleared --- so when I tap the device back button from Dialog 1
then takes back to Dialog 3
instead of going to Fragment
.
<fragment
android:id="@+id/fragment1"
android:name="fragment"
tools:layout="@layout/fragment1" />
<dialog
android:id="dialog1"
android:name="dialog1"
tools:layout="@layout/dialog1" />
<dialog
android:id="@+id/dialog2"
android:name="dialog2"
tools:layout="@layout/dialog2" />
<dialog
android:id="@+id/dialog3"
android:name="dialog3"
tools:layout="@layout/dialog3">
<action
android:id="@+id/actionToDialog1"
app:destination="@id/dialog1"
app:launchSingleTop="true"
app:popUpTo="@id/dialog1"
app:popUpToInclusive="true" />
</dialog>
On Device Back Button Tap I am having below code
navController.navigate(R.id.actionToDialog1);
FYI, navigation works fine, but once you land on Dialog 1
stack is not getting cleared and it should go to Fragment
instead goes to Dialog 3
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论