How to reset AnimationDrawable

后端 未结 5 1890
粉色の甜心
粉色の甜心 2020-12-14 15:01

I have to animate a circular count down timer and I\'m doing it by animating the background of an ImageView using AnimationDrawable (each image has the according slice of th

5条回答
  •  南笙
    南笙 (楼主)
    2020-12-14 15:54

    Another possible solution would be to have the same image for the first frame and last frame and do the following instead of calling the stop() method.

    ((AnimationDrawable)(someButton.getBackground())).setOneShot(true);
    

    if anyone does look into this any further. There is also a method called setVisible(boolean visible, boolean restart). However, that did not work for myself.

提交回复
热议问题