停止drawable的动画

时间:2015-01-25 19:29:30

标签: android android-animation android-drawable

我想用drawables做一个动画,但我想在显示最后一个drawable时停止这个动画。我使用过这段代码:

        final AnimationDrawable mailAnimation = (AnimationDrawable) muneco.getBackground();
        muneco.post(new Runnable() {
            public void run() {
                if ( mailAnimation != null ) mailAnimation.start();


              }
        });

我的anim.xml就是这样:

<?xml version="1.0" encoding="utf-8"?>
<animation-list xmlns:android="http://schemas.android.com/apk/res/android"
     android:oneshot="false"
      >

     <item  android:drawable="@drawable/dieciocho" android:duration="50"/>
     <item  android:drawable="@drawable/diecisiete" android:duration="50"/>
     <item  android:drawable="@drawable/dieciseis" android:duration="50"/>
     <item  android:drawable="@drawable/quince" android:duration="50"/>
     <item  android:drawable="@drawable/catorce" android:duration="50"/>
     <item  android:drawable="@drawable/trece" android:duration="50"/>

</animation-list> 

0 个答案:

没有答案