【发布时间】:2019-10-27 05:05:11
【问题描述】:
我在 Android 上使用具有 Single Activity 模式的 Android 架构组件。我使用的导航模式是 BottomNavigationView。我实际上希望父活动没有 ActionBar,但将我的主题设置为 NoActionBar 类型会使应用程序崩溃。在 Activity 中设置 Navigation 如下所示
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)
我如何设置底部导航以不使用 actionBar,因为我希望有一些带有 ActionBar 的片段,例如 CollapsingToolbarLayout?
【问题讨论】:
-
setting my theme to be of type NoActionBar crashes the App您是如何更改主题的,或者尝试这样做?
标签: android android-fragments android-actionbar android-architecture-components bottomnavigationview