In the Android Jetpack navigation component at for instance at here. I was wondering if it were possible to use default system animations (for instance the animation when starting a new activity) when screens change. This would be in the context of the enterAnim and the exitAnim parameters.
Add a comment
|
1 Answer
When you're using the editor you can define the animation for the enter and exit transitions:
And if you don't have any animations defined in the anim xml folder there are some default animations available. If none of those is good enough for you, you can simply create a transition that mimics the default ones and set it there.
To get the default animations you need to have the dependence:
implementation "android.arch.navigation:navigation-ui-ktx:1.0.0-alpha01"
5 Comments
Anthony Dito
Thanks for the answer! I was able to add the custom animations and I can see them in the drop down. However, I don't see the default animations (like nav_default_enter_anim)... I assume I setup my project incorrectly and will keep looking.
Levi Moreira
Did you add both the navigation-fragment and navigation-ui dependencies?
Levi Moreira
You'll need the navigation-ui dependence to get the default anim: implementation "android.arch.navigation:navigation-ui-ktx:1.0.0-alpha01"
Carson Holzheimer
Is there any way to set the transitions by default to every transition?
norekhov
For Android Jetpack dependency should be
androidx.navigation:navigation-ui-ktx