Android 停止可牵引´;s动画
我想用一个可绘制文件制作动画,但我想在显示最后一个可绘制文件时停止此动画。我使用了以下代码:Android 停止可牵引´;s动画,android,android-animation,android-drawable,Android,Android Animation,Android Drawable,我想用一个可绘制文件制作动画,但我想在显示最后一个可绘制文件时停止此动画。我使用了以下代码: final AnimationDrawable mailAnimation = (AnimationDrawable) muneco.getBackground(); muneco.post(new Runnable() { public void run() { if ( mailAnimation != null
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>
为什么不将android:oneshot
设置为true?然后你的drawable将播放一次。我不知道,非常感谢你也可以使用view.clearAnimation()来播放;