For animation between fragment I'm using the folder anim with the translate tag like this, I got 4 files : slide in from left
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:shareInterpolator="false">
<translate
android:fromXDelta="-100%" android:toXDelta="0%"
android:fromYDelta="0%" android:toYDelta="0%"
android:duration="230"/>
</set>
slide out to left
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:shareInterpolator="false">
<translate
android:fromXDelta="0%"
android:toXDelta="-100%"
android:fromYDelta="0%"
android:toYDelta="0%"
android:duration="230" />
</set>
slide in from right
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:shareInterpolator="false">
<translate
android:fromXDelta="100%" android:toXDelta="0%"
android:fromYDelta="0%" android:toYDelta="0%"
android:duration="230"/>
</set>
slide out to right
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:shareInterpolator="false">
<translate
android:fromXDelta="0%" android:toXDelta="100%"
android:fromYDelta="0%" android:toYDelta="0%"
android:duration="230" />
</set>
This works well between activity, the previous activity translate to the left and the new one appears from the right.
But I can't get the same animation when I call a fragment from an activity. I'm not using the support fragment so I need to use animation with object animator like this :
<objectAnimator
xmlns:android="http://schemas.android.com/apk/res/android"
android:duration="400"
android:propertyName="x"
android:valueFrom="2000"
android:valueTo="0"
android:valueType="floatType" />
I got 4 files again for the animation and I'm using it like this :
transaction.setCustomAnimations(R.animator.slide_in_from_left, R.animator.slide_out_to_left, R.animator.slide_in_from_right, R.animator.slide_out_to_right);
But with this animation the fragment come from the right and come above the activity I would like that the activity translate to the left I try to animate the activity just before call the fragment but this is not working :
findViewById(R.id.main_view).startAnimation( AnimationUtils.loadAnimation(MatchActivity.this, R.anim.slide_out_to_left));
How can I translate the activity when I'm calling the new fragment I want to have the same transition animation between all my view