i'm trying to replace default back button icon on toolbar like this:
toolbar.navigationIcon = R.drawable.lalala
it's fine, and it's working. But, when i'm trying to click back button, for a half second i can see default icon instead of mine. What i can do wrong ?
I'm using fragments and JetPack navigation.
Since you are using the Navigation Components, the expected behavior is the Up button displayed when you are on a non-root destination.
You can change it using the addOnDestinationChangedListener
after your setup method.
Something like:
navController.addOnDestinationChangedListener { _, destination, _ ->
if(destination.id == R.id.xxxx) {
toolbar.setNavigationIcon(R.drawable.xxxx)
} else {
//
}
}