android 简单帧动画

1.在drawable下创建donghua.xml


<animation-list xmlns:android="http://schemas.android.com/apk/res/android"
    android:oneshot="false">
    <item android:drawable="@drawable/sound_2" android:duration="100"/>
    <item android:drawable="@drawable/sound_1" android:duration="100"/>
animation-list>

2.在布局中调用

<ImageView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:background="@drawable/donghua"
            android:id="@+id/donghua"/>    
                  

3.java中创建一个动画

AnimationDrawable animationDrawable;
animationDrawable = (AnimationDrawable)imageView.getBackground();
animationDrawable.start();

你可能感兴趣的:(drawable效果)