我正在尝试从DialogFragment
to Fragment
在导航组件中,但得到奇怪的结果。
当我从DialogFragment
to Fragment
,背景片段正在更改为目标片段,当前对话框位于其顶部,而不仅仅是移动到目标片段。
这是导航图。
<navigation
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/home"
app:startDestination="@+id/titleScreen">
<fragment
android:id="@+id/titleScreen"
android:name="com.example.android.navigationadvancedsample.homescreen.Title"
android:label="@string/title_home"
tools:layout="@layout/fragment_title">
<action
android:id="@+id/action_title_to_about"
app:destination="@id/aboutScreen"/>
</fragment>
<dialog
android:id="@+id/aboutScreen"
android:name="com.example.android.navigationadvancedsample.homescreen.About"
android:label="@string/title_about"
tools:layout="@layout/fragment_about">
<action
android:id="@+id/action_aboutScreen_to_register"
app:destination="@id/register" />
</dialog>
<fragment
android:id="@+id/register"
android:name="com.example.android.navigationadvancedsample.formscreen.Register"
android:label="fragment_leaderboard"
tools:layout="@layout/fragment_leaderboard" />
</navigation>
为什么我会出现这种行为或如何解决它?
我所说的修复是指正常的对话行为。说,我有一个对话D在片段之上A并移动到一个片段B从一个按钮D,屏幕应显示B。当我从B,它应该进入前一阶段D在之上A.
感谢@musooff 提交this bug https://issuetracker.google.com/issues/134089818
此问题以及其他对话框不一致的问题已在 Navigation 2.1.0-alpha06 上得到修复弹出对话框时的后退按钮 https://issuetracker.google.com/issues/133600763.
但是,如果可以的话,请更新到 2.1.0-beta02 或更高版本。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)