amitairos amitairos - 1 year ago 159
Java Question

Repeat AnimationDrawable every few seconds

I have an AnimationDrawable that animates a set of frame images.

How do I implement a restart every 10 seconds?


Neo Neo
Answer Source

Yes you can, just give your last frame 10 second extra. Example -

    <animation-list xmlns:android=""  android:oneshot="false">
  <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="10100" />

Hope it will help :)