我在 Android 上使用具有单活动模式的 Android 架构组件。我使用的导航模式是 BottomNavigationView。我实际上希望父活动没有 ActionBar,但将我的主题设置为 NoActionBar 类型会使应用程序崩溃。在 Activity 中设置导航已完成,如下所示
val navController = findNavController(R.id.nav_host_fragment)
// Passing each menu ID as a set of Ids because each
// menu should be considered as top level destinations.
val appBarConfiguration = AppBarConfiguration(
setOf(R.id.navigation_popular, R.id.navigation_top_rated, R.id.navigation_favorites)
)
setupActionBarWithNavController(navController, appBarConfiguration)
navView.setupWithNavController(navController)
Run Code Online (Sandbox Code Playgroud)
由于我希望拥有一些带有 ActionBar 的片段(例如 CollapsingToolbarLayout),因此如何设置底部导航以没有 actionBar?
android android-fragments android-actionbar bottomnavigationview android-architecture-components