how can i remove toolbar animation when I am using navigation component with toolbar like this:
NavigationUI.setupWithNavController(toolbar, findNavController(R.id.nav_host_fragment))
Inside each fragment i have custom menu (and setHasOptionsMenu(true)
). On every fragment transaction made by findNavController().popBackstack()
toolbar menu items has ugly transition animation.
If i remove setupWithNavController
, animation disappers, but i need it.
I figured out that you don't get these animations if you call Activity.setupActionBarWithNavController
or NavigationUI.setupActionBarWithNavController
instead of the Toolbar-specific function.
You also have to override onSupportNavigateUp
to handle the up button if you use this approach:
override fun onSupportNavigateUp(): Boolean {
return navController.navigateUp() || super.onSupportNavigateUp()
}
And if you use a Toolbar, don't forget to call setSupportActionBar(toolbar)
to make the Toolbar your default ActionBar.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With