如何创建一个动态的drawable
首先得有几组图片
创建drawable
xmlns:android="http://schemas.android.com/apk/res/android"
android:oneshot="false">
运行动态图片的代码
private void play() {
if (animationView.getBackground() instanceof AnimationDrawable) {
AnimationDrawable animation = (AnimationDrawable) animationView.getBackground();
animation.start();
}
}
private void stop() {
if (animationView.getBackground() instanceof AnimationDrawable) {
AnimationDrawable animation = (AnimationDrawable) animationView.getBackground();
animation.stop();
animation.selectDrawable(2);
}
}