导航图和多个主机活动 [英] Navigation graphs and multiple host activities

查看:59
本文介绍了导航图和多个主机活动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个功能模块,闪屏,它具有一个nav_splash图形和一个SplashActivity.

当我导航到第二个功能模块main时,它具有一个nav_main图和一个MainActivity,而不是将MainActivity用作主机(即使在导航编辑器中它也显示为主机),它仍将SplashActivity用作主机. /p>

因此,除了导航到nav_main图之外,现在我必须导航至活动(MainActivity)以强制将该活动用作主机.

这是故意的吗?还是一个错误?

使用多个活动的第一个原因是清单文件中的活动具有不同的主题.

解决方案

除非您专门导航到<activity>目标,否则您将停留在同一活动中,该活动可以按预期进行.

I have a feature module, splash, which has a nav_splash graph and a SplashActivity.

When I navigate to a second feature module, main, which has a nav_main graph and a MainActivity, instead of using MainActivity as host (even in the navigation editor it is appearing as host), it keeps using SplashActivity as host.

So instead of navigating to nav_main graph, now I have to navigate to an activity (MainActivity) to force the use of this activity as host.

Is this intentionally? Or is it a bug?

The first reason to use multiple activities is that they have different themes in the manifest file.

解决方案

Unless you're specifically navigating to an <activity> destination, you'll stay in the same activity, that is working as intended.

这篇关于导航图和多个主机活动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆