1.创建动画xml文件
<animation-list xmlns:android="http://schemas.android.com/apk/res/android"
android:oneshot="false"> #oneshot表示显示次数
<item android:drawable="@drawable/img_back" android:duration="300" />
<item android:drawable="@drawable/img_pass_close" android:duration="300" />
</animation-list>
2.将动画设置成imageview背景
ImageView iv_load = (ImageView)findViewById(R.id.iv_is_waller);
iv_load.setBackgroundResource(R.anim.an_into_waller);
3.通过imageview得到动画,并控制动画的开始与停止
AnimationDrawable mAnmation = (AnimationDrawable)iv_load.getBackground();
mAnmation.start();
mAnmation.stop();