开发者

Stopping an android animation in its original state

开发者 https://www.devze.com 2023-03-19 12:48 出处:网络
I have an animated rotatin开发者_StackOverflowg ImageButton. <?xml version=\"1.0\" encoding=\"utf-8\"?>

I have an animated rotatin开发者_StackOverflowg ImageButton.

<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android"  >
    <rotate
        android:fromDegrees="0"  
        android:toDegrees="360"  
        android:pivotX="50%"  
        android:pivotY="50%"  
        android:repeatCount="infinite"  
        android:duration="2000" />
</set>

It starts when a user clicks it and runs an AsyncTask. Right now, after the AsyncTask reaches PostExecute, it jumps abruptly to its original state and stops.

Can I avoid that abrupt jump and just continue rotating until it reaches its original position and then have it stop there?

I'm using this to stop the animation at PostExecute right now:

refresh.getAnimation().cancel();

Thanks!


Turns out it was pretty simple. I emailed the Catch Notes developer since this was inspired from their app.

refresh.getAnimation().setRepeatCount(0);

on PostExecute.

0

精彩评论

暂无评论...
验证码 换一张
取 消