目录
无标题.png
说明
动画由一系列图片组成,一帧一帧播放
onshot属性(true:只播放一次 false:播放多次)
演示
图片引用了:
image.png
代码
ss.xml (Drawable) 动画布局文件
<?xml version="1.0" encoding="utf-8"?>
<animation-list
android:oneshot="false">
<item
android:drawable="@drawable/gpf"
android:duration="100" />
<item
android:drawable="@drawable/gpo"
android:duration="100" />
<item
android:drawable="@drawable/gpn"
android:duration="100" />
</animation-list>
layout
<ImageView
android:layout_width="match_parent"
android:id="@+id/img"
android:layout_height="match_parent"
android:src="@drawable/ss"/>
java
AnimationDrawable animationDrawable = (AnimationDrawable) imgHead.getDrawable();
animationDrawable.start();