I would like to change up button icon in ActionBar that is working with Navigation Component. I've tried several options like:
supportActionBar?.setHomeAsUpIndicator(R.drawable.ic_arrow_left_blue_24dp)
in MainAcitivty
or
app:navigationIcon="@drawable/ic_arrow_left_blue_24dp"
in Toolbar
.xml file and nothing seems to work.
I have a pretty standard setup with
setSupportActionBar(appToolbar.toolbar)
setupActionBarWithNavController(this, navController)
called in MainActivity:onCreate
method.
I would expect that
supportActionBar?.setHomeAsUpIndicator(R.drawable.ic_arrow_left_blue_24dp)
would work, because for example disabling title for ActionBar
by calling:
supportActionBar?.setDisplayShowTitleEnabled(false)
works as expected and title is not set to Fragment
name while navigating.
What's more, I investigated a little bit and in ActionBarOnDestinationChangedListener
there is a call to setNavigationIcon
which is setting an icon to DrawerArrowDrawable
, which is a little bit weird since I'm not using Drawer
in my setup.
Also changing to:
setupWithNavController(toolbar, navController)
is not working because ToolbarOnDestinationChangedListener
also using the same DrawerArrowDrawable
.