I want to show the enterTransition on top of the exitTransition.
But as you can see in the gif, the enterTransition is below the exitTransition.
How can I solve this problem?
The navigation component
is used for fragment transitions.
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
enterTransition = Slide().apply {
duration = 2000
slideEdge = Gravity.END
}
}
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
exitTransition = Slide().apply {
duration= 3000
slideEdge = Gravity.START
}
}
<action
android:id="@+id/move"
app:destination="@id/fragment_enter"
/>
Please refer to the official documentation for transition animations with navigation component: https://developer.android.com/guide/navigation/navigation-animate-transitions
You will need to put your animations in a respective animation xml file and then reference it in your nav_graph xml within the respective action. You can then specify when which animation should be used.