Циклическая покадровая анимация - PullRequest
0 голосов
/ 11 мая 2011

Я пытаюсь заставить мою анимацию работать только 6 раз, я установил oneshot="true" и попытался зациклить анимацию, но она не работает, анимация все еще запускается только один раз.

Любая помощь очень ценится.

Вот код

<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>

.

    for (int i = 0; i < 5; i++){
        img.setBackgroundResource(R.anim.anime);
        AnimationDrawable frameAnimation = (AnimationDrawable)img.getBackground();
        frameAnimation.setCallback(img);
        frameAnimation.setVisible(true, true);
        frameAnimation.start();
   }

1 Ответ

1 голос
/ 15 июля 2011
for (int i = 0; i < 5; i++){
    img.setBackgroundResource(R.anim.anime);
    AnimationDrawable frameAnimation = (AnimationDrawable)img.getBackground();
    frameAnimation.setCallback(img);
    frameAnimation.setVisible(true, true);
    frameAnimation.start();
}
frameAnimation.stop();
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...