动画效果如下:
代码如下:
1、anim文件夹下建立xml文件:
notices_anim.xml
<?xml version="1.0" encoding="utf-8"?><animation-list xmlns:android="/apk/res/android" ><item android:drawable="@drawable/notices_img_1" android:duration="500"/><item android:drawable="@drawable/notices_img_2" android:duration="500"/><item android:drawable="@drawable/notices_img_3" android:duration="500"/></animation-list>
/2、布局文件:
ImageView
<ImageViewandroid:id="@+id/iv_notices_img"android:layout_width="wrap_content"android:layout_height="wrap_content"android:background="@anim/notices_anim"/>
3、代码启动动画
((AnimationDrawable) ivNoticesImg.getBackground()).start();