I am using Navigation component, and I have a bottom navigation view in the main activity. when I tap the tab in that bottom navigation view, it seems that there is a fade i
@HvSimon has provided a solution to set the global default which hasn't worked for me. Also I would like to choose/disable the animations per transition.
You can supply additional arguments to navigate() with a NavOptions object.
First create an animation in your res folder like res/anim/nav_enter_anim.xml (empty for no animation):
Create one animation xml per animation or reuse the same. Then supply a NavOptions object to your navigate() call like so:
val animationOptions = NavOptions.Builder().setEnterAnim(R.anim.nav_enter_anim)
.setExitAnim(R.anim.nav_exit_anim)
.setPopEnterAnim(R.anim.nav_pop_enter_anim)
.setPopExitAnim(R.anim.nav_pop_exit_anim).build()
findNavController().navigate(MyFragmentDirections.toMainActivity(), animationOptions)