1、帧动画 帧动画就是顺序播放一组预先定义好的图片,就类似于我们观看视频,就是一张一张的图片连续播放。
帧动画的使用很简单,总共就两个步骤:
1、在res/drawable目录下定义一个XML文件,根节点为系统提供的animation-list,然后放入定义更好的图片; 2、使用AnimationDrawable类播放第一步定义好的Drawable中的图片,形成动画效果; 代码示例,第一步,创建Drawable文件:
<?xml version="1.0" encoding="utf-8"?>
<animation-list xmlns:android="http://schemas.android.com/apk/res/android"
android:oneshot="false">
<item android:drawable="@drawable/image01" android:duration="500"/>
<item android:drawable="@drawable/image02" android:duration="500"/>
<item android:drawable="@drawable/image03" android:duration="500"/>
</animation-list>
上述xml中,有些属性我们要了解到:
- 1、android:oneshot=“false”: 表示是否重复播放动画,还是只播放一次;
- 2、每个item都有Drawable和duration属性,Drawable表示我们要播放的图片;duration表示这张图播放的时间;

?
?
?
?
?
?

?
?
?
|