I am trying to use animation while replacing fragments (with replace() of fragment transaction). I set animtaions with setCustomAnimations().
My animation is trying to overlap an old fragment with a new one moving from right. But the problem is: I can see views from old fragment even when it is already overlapped by the new one. And old views dissapear only when the animation is done. Also, when a new fragment is a complicated one (listviews, etc...), I can see some artefacts and flickering while overlapping.
This is terrible, how can i avoid that?
My code for enter animation:
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:ordering="together">
<objectAnimator xmlns:android="http://schemas.android.com/apk/res/android"
android:interpolator="@android:anim/linear_interpolator"
android:propertyName="x"
android:valueType="floatType"
android:valueTo="0"
android:valueFrom="720"
android:duration="250"
android:zAdjustment="top"/>
</set>
UPDATE: about artefacts - it's not them. It was just the consequences of bad overlay. I watched animation slowly. So the problem is: the old fragment stays on TOP. It completely overlaps the new one while animating.