I have set up my navigation bar like this
with(ActivityHolderBinding.inflate(layoutInflater)) {
setContentView(root)
val fragment = supportFragmentManager.findFragmentByTag("holder") as NavHostFragment
toolbar.setupWithNavController(fragment.navController,AppBarConfiguration(fragment.navController.graph))
setSupportActionBar(toolbar)
}
But this only shows a back button when I navigate to another fragment and not when I navigate to self on the fragment marked as start destination.
As per this issue:
So by having two different IDs, it is possible for
NavigationUI
to distinguish between your first level (which should not display an up arrow) vs ones that should display an up arrow.