I'm using animation between my fragment :
slide in from left :
<?xml version="1.0" encoding="utf-8"?>
<set>
<objectAnimator
xmlns:android="http://schemas.android.com/apk/res/android"
android:duration="600"
android:propertyName="x"
android:valueFrom="2000"
android:valueTo="0"
android:valueType="floatType"
android:fillAfter="true"/>
</set>
slide in from right :
<?xml version="1.0" encoding="utf-8"?>
<set>
<objectAnimator
xmlns:android="http://schemas.android.com/apk/res/android"
android:duration="600"
android:propertyName="x"
android:valueFrom="0"
android:valueTo="-400"
android:valueType="floatType"/>
</set>
This animation move the previous fragment to left and the new one come from the right. I'm using it with a fragment transaction.
transaction.setCustomAnimations(R.animator.slide_in_from_left,R.animator.slide_in_from_right);
I got a trouble when the new fragment come he slide below the older one, for fix it I put an elevation on my new fragment but I would like a solution for API below 21. Is it possible to force the new fragment to be above the older fragment