android - Looping frame by frame animation -
i'm trying animation run 6 times, set oneshot="true"
, tried loop animation doesn't work, animation still runs once.
any appreciated.
here code
<animation-list xmlns:android="http://schemas.android.com/apk/res/android" android:oneshot="true"> <item android:drawable="@drawable/image" android:duration="100" /> <item android:drawable="@drawable/image1" android:duration="100" /> <item android:drawable="@drawable/image2" android:duration="100" /> <item android:drawable="@drawable/image3" android:duration="100" /> <item android:drawable="@drawable/image4" android:duration="100" /> </animation-list>
.
(int = 0; < 5; i++){ img.setbackgroundresource(r.anim.anime); animationdrawable frameanimation = (animationdrawable)img.getbackground(); frameanimation.setcallback(img); frameanimation.setvisible(true, true); frameanimation.start(); }
for (int = 0; < 5; i++){ img.setbackgroundresource(r.anim.anime); animationdrawable frameanimation = (animationdrawable)img.getbackground(); frameanimation.setcallback(img); frameanimation.setvisible(true, true); frameanimation.start(); } frameanimation.stop();
Comments
Post a Comment