Is there a way how to change the z-order in which are fragments displayed during an ongoing FragmentTransaction? I've an animation where both fragments overlaps each other and I would like to have the fragment which slides from the right (the second fragment) displayed under the other one which slides to the left. Right now they are displayed in opposite order during the transaction.
Here is code of one of my animations:
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:duration="400"
android:zAdjustment="bottom">
<scale android:toXScale="1"
android:fromXScale="0.9"
android:pivotX="50%p"
android:pivotY="50%p"
android:toYScale="1"
android:startOffset="300"
android:fromYScale="0.9"/>
<translate android:fromXDelta="50%p"
android:interpolator="@android:interpolator/overshoot"
android:toXDelta="0"/>
</set>
And here is the code of the transaction
FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
ft.show(fragmentToShow).hide(fragmentToHide).commit();
I would like to have the fragmentToHide
to appear under the fragmentToShow
.
I've tried to tackle with the android:zAdjustment
property, but since it apparently works only for window animations it just haven't worked for me.