Transaction Animation Overlay

I am trying to use animation when replacing fragments( replace()of fragment transaction). I installed animations using setCustomAnimations(). Mine is animationtrying to combine the old fragmentwith the new one moving to the right. But the problem is that I see the view from the old fragment, even if it is already overlapping with the new. And the old ones viewsdisappear only when the animation is complete. Also, when the new one fragmentis complex ( listviewsetc.), I see some artifacts and flicker when overlapping. This is terrible, how can I avoid this?

My input code is 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>

: - . . . , TOP. .

+4
2

- , , , , ,

transaction.setCustomAnimations(<enterAnimationResId>, <exitAnimationResId>);

enterAnimationResId - xml , , exitAnimationResId - XML , , .

+1

, , , . , , .

android:background="@drawable/background"
0

Source: https://habr.com/ru/post/1621116/


All Articles