问题描述
我正在学习android开发和导航组件,尝试将多个活动链接为文档已经写好了.但是,似乎不可能在两个活动之间为单个导航图创建动作,而这对我来说是合理的,正如文档所写.
I'm learning android development and the navigation component, trying to link multiple activities as the document had written. But it seems like it's impossible to create action between two activities to a single navigation graph which was reasonable to me as the document had written.
所以问题是以下句子是什么意思?我可以将多个活动添加到一个导航图,但不能在它们之间添加链接(动作).
So the question is what does the following sentence mean? I could add multiple activities to one navigation graph but couldn't add a link(action) between them.
推荐答案
由于每个NavController和导航图都包含在单个活动中,因此<activity>
目标是该图的出口点-一旦使用navigate(R.id.your_activity_destination)
即可转到下一个活动,即NavController和图形不再处于活动状态(它位于后堆栈上的活动上,而不是新启动的活动上.)
Since each NavController and navigation graph is contained within a single activity, an <activity>
destination is an exit point from that graph - once you use navigate(R.id.your_activity_destination)
to go to the next activity, that NavController and graph is no longer active (it is on the activity on the back stack, not the newly launched activity).
在第二个活动中,您将具有另一个导航图,其中包含任何其他<activity>
出站目的地,可用于进一步的活动.
On your second Activity, you would have a second navigation graph with any additional <activity>
outbound destinations to go to further activities.
这篇关于如何在android导航编辑器中链接多个活动?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!