我有两个图表 nav_graph1.xml 和 nav_graph2.xml(在两个不同的模块/库中)
我想使用 bundles从 fragment1 导航到 fragment2 。如何使用导航组件实现?
nav_graph1.xml
<?xml version="1.0" encoding="utf-8"?>
<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/nav_graph1"
app:startDestination="@id/fragment1">
<fragment
android:id="@+id/C1_fragment"
android:name="com.example.multiplenavigation.C_nav_graph.C1 "
android:label="C1"
tools:layout="@layout/fragment_C1">
<action
android:id="@+id/C1_to_C2_fragment"
app:destination="@id/C2_fragment" />
</fragment>
</navigation>
nav_graph2.xml
<?xml version="1.0" encoding="utf-8"?>
<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/nav_graph1"
app:startDestination="@id/fragment2">
<fragment
android:id="@+id/fragment2"
android:name="com.example.multiplenavigation.C_nav_graph.C1 "
android:label="C2"
tools:layout="@layout/fragment_C2">
</fragment>
</navigation>
提前致谢,