I use navigation component in my app. I set slide up/down animation for fragment transaction.But I didn't get desired result.The behavior I want is: when new fragment(A) replace to previous fragment(B),previous fragment keep be fixed(without animation) and new fragment come down from up to up and when user press back button,fragment B slide from up to down and fragment A keep fixed. The behavior that I get at the moment: when new fragment(A) replace to previous fragment(B),previous fragment also moved and when user press back button,fragment A also moved. this is Four animation file i have used: enter_from_up.xml:
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:shareInterpolator="false"
android:interpolator="@android:anim/linear_interpolator">
<translate
android:fromXDelta="0%" android:toXDelta="0%"
android:fromYDelta="-100%" android:toYDelta="0%"
android:duration="350" />
exit_from_down.xml:
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:shareInterpolator="false"
android:interpolator="@android:anim/linear_interpolator">
<translate
android:fromXDelta="0%" android:toXDelta="0%"
android:fromYDelta="0%" android:toYDelta="100%"
android:duration="350" />
enter_from_down.xml:
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:shareInterpolator="false"
android:interpolator="@android:anim/linear_interpolator">
<translate
android:fromXDelta="0%" android:toXDelta="0%"
android:fromYDelta="100%" android:toYDelta="0%"
android:duration="350" />
exit_from_up.xml:
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:shareInterpolator="false"
android:interpolator="@android:anim/linear_interpolator">
<translate
android:fromXDelta="0%" android:toXDelta="0%"
android:fromYDelta="0%" android:toYDelta="-100%"
android:duration="350" />
</set>
And this is code of my navigation graph:
<action
android:id="@+id/action_welcomeFragment_to_signUpOneFragment" app:destination="@id/signUpOneFragment"
app:enterAnim="@anim/enter_from_down"
app:exitAnim="@anim/exit_from_up"
app:popEnterAnim="@anim/enter_from_up"
app:popExitAnim="@anim/exit_from_down"/>