问题描述
我正在寻找来自 google 的高级示例:https://github.com/android/architecture-components-samples/tree/main/NavigationAdvancedSample
他们像这样从 MainActivity 定义底部导航栏:
private fun setupBottomNavigationBar() {
val bottomNavigationView = findViewById<BottomNavigationView>(R.id.bottom_nav)
val navGraphIds = listof(R.navigation.home,R.navigation.list,R.navigation.form)
// Setup the bottom navigation view with a list of navigation graphs
val controller = bottomNavigationView.setupWithNavController(
navGraphIds = navGraphIds,fragmentManager = supportFragmentManager,containerId = R.id.nav_host_container,intent = intent
)
// Whenever the selected controller changes,setup the action bar.
controller.observe(this,Observer { navController ->
setupActionBarWithNavController(navController)
})
currentNavController = controller
bottomNavigationView
}
有 3 个不同的导航图,如何在片段中单击按钮时从一个图导航到另一个保持状态?
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)