可以用来做帧动画
属性:
- oneshot 是否循环
- duration 持续时间
<?xml version="1.0" encoding="utf-8"?>
<animation-list xmlns:android="http://schemas.android.com/apk/res/android"
android:oneshot="false"
>
<item android:drawable="@color/color01" android:duration="200"/>
<item android:drawable="@color/color02" android:duration="200"/>
<item android:drawable="@color/color03" android:duration="200"/>
<item android:drawable="@color/color04" android:duration="200"/>
<item android:drawable="@color/color05" android:duration="200"/>
</animation-list>
<ImageView
android:id="@+id/iv"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_constraintTop_toBottomOf="@+id/tb"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
android:gravity="center"
android:onClick="toMain"
android:src="@drawable/animationlists"/>
iv = findViewById(R.id.iv);
drawable =(AnimationDrawable) iv.getDrawable();
drawable.start();