使用导航组件在深层嵌套图形之间导航

时间:2021-07-07 13:54:31

标签: android navigation bottomnavigationview android-bottomnavigationview

实现的导航图结构如下图。

arrows represent include tags

但不幸的是,当从顶部片段(OneFragment、TwoFragment 和 ThreeFragment)导航到较低片段(OtherFragment)时, 出现异常:

java.lang.IllegalArgumentException: Navigation destination [package_name]:id/otherFragment referenced from action [package_name]:id/action_OneFragment_to_OtherFragment cannot be found from the current destination Destination([package_name]:id/oneFragment)

采用这种结构的原因是为了避免大型 Navigation.xml 文件,并且项目中还使用了 NaviagtionAdvancedSample 旧版本,其中每个 BottomNavigaationView 选项卡都应该有自己的图表。

0 个答案:

没有答案