Frame By Frame Animations

在drawable文件夹下新建一个animation-list的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/nv1" android:duration="500"/>
    <item android:drawable="@drawable/nv2" android:duration="500"/>
    <item android:drawable="@drawable/nv3" android:duration="500"/>
    <item android:drawable="@drawable/nv4" android:duration="500"/>
    <item android:drawable="@drawable/nv5" android:duration="500"/>
    <item android:drawable="@drawable/nv6" android:duration="500"/>
    <item android:drawable="@drawable/nv7" android:duration="500"/>
    <item android:drawable="@drawable/nv8" android:duration="500"/>
    <item android:drawable="@drawable/nv9" android:duration="500"/>
    <item android:drawable="@drawable/nv10" android:duration="500"/>

</animation-list>

在java代码中:

imageView.setBackgroundResource(R.drawable.item_list);
AnimationDrawable ad = (AnimationDrawable)imageView.getBackground();
ad.start();

 
Frame By Frame Animations
 

相关推荐