I have a fragment replace transaction setup like so:
CreateGestureFragment frag = new CreateGestureFragment(number, name, type);
FragmentTransaction transaction = getFragmentManager().beginTransaction();
transaction.setCustomAnimations(R.animator.zoom_enter, R.animator.anim_stay, R.animator.anim_stay, R.animator.zoom_exit);
transaction.replace(R.id.fragment_container, frag);
transaction.addToBackStack(null);
transaction.commit();
And my zoom_enter is like so:
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:ordering="together" >
<objectAnimator
android:propertyName="scaleX"
android:valueFrom="0.5"
android:valueTo="1.0"
android:duration="@android:integer/config_mediumAnimTime">
</objectAnimator>
<objectAnimator
android:propertyName="scaleY"
android:valueFrom="0.5"
android:valueTo="1.0"
android:duration="@android:integer/config_mediumAnimTime">
</objectAnimator>
The anim_stay is just a placeholder, there is no actual animation for it (i just set scaleX from 1.0 to 1.0). The intended behavior for replacing fragment A with fragment B is: Fragment B enters while zooming in on top of fragment A, and when popping back, fragment B exits while zooming out and reveals the fragment A from before.
However it seems that when replacing, fragment A's animation happens on top of fragment B's animation, thus the animation will be missed until the animation is completed and fragment B is shown entirely. The question is, how do I layer the animation of fragment B's zoom enter on top of fragment A such that I can see the actual animation?
I tried setting the animation of fragment A to simply 0, however in this case, although I can see the zoom enter of fragment B, fragment A simply disappears at the start of the animation which is not what I want.