自己写个帧动画zhuzhen
<?xmlversion="1.0"encoding="utf-8"?>
<animation-list
xmlns:android="http://schemas.android.com/apk/res/android"
android:oneshot="false">
<itemandroid:drawable="@drawable/progress_1"android:duration="200"/>
<itemandroid:drawable="@drawable/progress_2"android:duration="200"/>
<itemandroid:drawable="@drawable/progress_3"android:duration="200"/>
<itemandroid:drawable="@drawable/progress_4"android:duration="200"/>
<itemandroid:drawable="@drawable/progress_5"android:duration="200"/>
<itemandroid:drawable="@drawable/progress_6"android:duration="200"/>
<itemandroid:drawable="@drawable/progress_7"android:duration="200"/>
<itemandroid:drawable="@drawable/progress_8"android:duration="200"/>
</animation-list>
android:oneshot=”false”的意思是循环播放
2.首先给图片设置
<ImageView
android:id="@+id/iv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@anim/zhuzhen"
android:layout_gravity="center"/>
AnimationDrawable anim= (AnimationDrawable) iv.getBackground();
anim.start();
注意点:anim.start();不能直接放入oncreate里面,,还没有真正的焦点获取
如果想启动界面自动执行start()的话 需要放入:onWindowFocusChanged里面