I've sat up a bottom navigation bar in my app. When I enable action bar with navController
, the up button shows when navigating between tabs.
[Fig.1: up button is gone when I'm in home destination]
[Fig.2: up button show up when navigation between tabs]
It goes away when i remove this line in MainActivity
but then I lose up button for the whole app:
setUpActionBarWithNavCotroller(navController)
How can i make "Up Button" disapper from bottom navigation tabs?
Your Tasks
and Categories
are top-level
destinations. So, you have to assign them to navController. Here's the official documentation.
Initialize AppBarConfiguration
as follow
val appBarConfiguration = AppBarConfiguration(
topLevelDestinationIds = setOf(R.id.tasksFragment, R.id.categoriesFragment)
)
Assign them to navController with your Toolbar
findViewById<Toolbar>(R.id.toolbar)
.setupWithNavController(navController, appBarConfiguration)
or ActionBar
setupActionBarWithNavController(navController, appBarConfiguration)