答案 0 :(得分:0)
在nav_graph.xml
中,将此行添加为导航属性。
app:startDestination="@+id/auth"
您不需要输入ID auth
。将auth
更改为splashFragment
<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/navigation"
app:startDestination="@id/splashFragment">
在splashFragment中,添加这两行
app:popUpTo="@id/nav_graph"
app:popUpToInclusive="true"
应该是这样
<fragment
android:id="@+id/splashFragment"
android:name="co.farouk.SplashFragment"
android:label="fragment_splash"
tools:layout="@layout/fragment_splash">
<action
app:popUpTo="@id/nav_graph"
app:popUpToInclusive="true"
android:id="@+id/action_splashFragment_to_welcomeFragment"
app:destination="@id/welcomeFragment" />
</fragment>