Foggy day

Android - screen flickering whilefragment transaction 본문

Android

Android - screen flickering whilefragment transaction

jinhan38 2021. 4. 3. 19:14

when you use a animation in a fragment transaction, screen would flicker.

It is caused because of animation drawable.

 

If you use animation drawable like below, obviously flickering occurs

 

slide_in_right.xml

<set xmlns:android="http://schemas.android.com/apk/res/android">
    <translate
        android:duration="300"
        android:fromXDelta="100%p"
        android:interpolator="@android:anim/accelerate_decelerate_interpolator"
        android:toXDelta="0" />
</set>

 

The cause is set. 

 

Remove <set/>

<translate xmlns:android="http://schemas.android.com/apk/res/android"
    android:duration="300"
    android:fromXDelta="100%p"
    android:interpolator="@android:anim/accelerate_decelerate_interpolator"
    android:toXDelta="0" />