Android Flicker when using Animation and onAnimationEnd Listener

后端 未结 2 1088
青春惊慌失措
青春惊慌失措 2021-01-26 18:11

I have 3 ImageButtons which are animated when Filling to left, like this:

public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY         


        
2条回答
  •  执笔经年
    2021-01-26 18:25

    I searched for all stackoverflow posts for animation issue (flicker and sluggish). I didnt find any perfect answer. But I have found the solution for the same, which is as below,

    onStart of Animation use,

    view_you_want_to_animate.setDrawingCacheEnabled(true);
    

    onEnd of Animation use,

    view_you_want_to_animate.setDrawingCacheEnabled(false);
    

    Now my view does not have flicker or sluggish behavior when my view is animating. I works well for me.

提交回复
热议问题