gpt4 book ai didi

Android导航组件: How to solve the circular navigation with nested graph?

转载 作者:行者123 更新时间:2023-12-03 13:27:42 25 4
gpt4 key购买 nike

在我们的用户需求中,我们有这样的流程。
enter image description here
我搜索了以下内容:
https://developer.android.com/guide/navigation/navigation-principles
Circular Reference with Nested Nav Graphs
但没有什么可以帮助...
我做了什么?
目前我拆分 2 个图并在 Graph2 中添加重复的 fragment C。此外,我以编程方式将图形开始目标更改为图形 1 中的 fragment C,只是我从图形 2 中单击。这是一个丑陋的解决方案,但我不知道如何解决这个问题。
我的问题是:有没有办法做到这一点,而不是制作一个重复的目的地并更改起始目的地?
图1:

<include app:graph="@navigation/graph2" />
<dialog
android:id="@+id/fragmentA"
android:label="Fragment A"
tools:layout="@layout/fragmentA"/>
<dialog
android:id="@+id/fragmentB"
android:label="Fragment B"
tools:layout="@layout/fragmentB">
<action
android:id="@+id/NavigateToGraph2"
app:destination="@id/graph2">
</dialog>
<dialog
android:id="@+id/fragmentC"
android:label="Fragment C"
tools:layout="@layout/fragmentC"/>
<dialog
android:id="@+id/fragmentD"
android:label="Fragment D"
tools:layout="@layout/fragmentD"/>
<dialog
android:id="@+id/fragmentE"
android:label="Fragment E"
tools:layout="@layout/fragmentE"/>
图 2
<dialog
android:id="@+id/fragmentF"
android:label="Fragment F"
tools:layout="@layout/fragmentF"/>
<dialog
android:id="@+id/fragmentG"
android:label="Fragment G"
tools:layout="@layout/fragmentG"/>
<dialog
android:id="@+id/fragmentC"
android:label="Fragment C"
tools:layout="@layout/fragmentC"/>

最佳答案

我认为最好为 fragment F 创建一个图形并打破循环。

关于Android导航组件: How to solve the circular navigation with nested graph?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/65122183/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com