【发布时间】:2020-09-10 12:21:12
【问题描述】:
由于某种情况,我需要在我的应用程序的两个不同活动中使用两个 navHostFragment。
一切正常,直到我在我的应用程序中添加第二个navhostframent,这会创建一个带有错误的inflateexception:
Binary XML file line #36: Duplicate id 0x7f09018a, tag null, or parent id 0xffffffff with another fragment for androidx.navigation.fragment.NavHostFragment
以下是我的第二个 navhost 片段:
<fragment
android:id="@+id/nav_host_fragment_supervisor"
android:name="androidx.navigation.fragment.NavHostFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="@+id/bottomNav"
android:layout_below="@+id/appbar"
app:defaultNavHost="true"
app:navGraph="@navigation/navigation_graph_supervisor" />
请帮忙。
【问题讨论】:
-
你能把你所有的
xml发上来吗?
标签: java android android-layout kotlin android-fragments