</pre>第一步:先定义Animation-List<p></p><p><pre name="code" class="html"><?xml version="1.0" encoding="utf-8"?>
<animation-list xmlns:android="http://schemas.android.com/apk/res/android" >
<item
android:drawable="@drawable/loading_1"
android:duration="100">
</item>
<item
android:drawable="@drawable/loading_2"
android:duration="100">
</item>
<item
android:drawable="@drawable/loading_3"
android:duration="100">
</item>
<item
android:drawable="@drawable/loading_4"
android:duration="100">
</item>
<item
android:drawable="@drawable/loading_5"
android:duration="100">
</item>
</animation-list>
第二步加载Animiation-List
在代码中实现如下:
AnimationDrawable ad=(AnimationDrawable) context.getResources().getDrawable(R.drawable.drawable_animation);
view.setBackgroundDrawable(ad);
ad.start();