============================首先看看官网上关于Frame animation的介绍================================
An animation defined in XML that shows a sequence of images in order (like a film).
<dl></dl>
<dt>FILE LOCATION:</dt>
<dd></dd>
<code>res/drawable/filename.xml</code>
The filename will be used as the resource ID.
<dt>COMPILED RESOURCE DATATYPE:</dt>
<dt>RESOURCE REFERENCE:</dt>
In XML: <code>@[package:]drawable.filename</code>
<dt>SYNTAX:</dt>
ELEMENTS:
<dt><code><animation-list></code></dt>
Required. This must be the root element. Contains one or more <code><item></code> elements.
attributes:
<dt><code>android:oneshot</code></dt>
Boolean. "true" if you want to perform the animation once; "false" to loop the animation.
<dt><code><item></code></dt>
<dd>A single frame of animation. Must be a child of a <code><animation-list></code> element.</dd>
<dt><code>android:drawable</code></dt>
Drawable resource. The drawable to use for this frame.
<dt><code>android:duration</code></dt>
Integer. The duration to show this frame, in milliseconds.
============================下面通过一个小案例来学习Frame animation================================
step1:新建一个Android项目FrameAnimationDemo
step2:准备好该应用使用的图片,用来做Frame Animation的,并将动画放入drawable目录下
step3:新建一个用来描述Frame动画的xml文件,res/anim/frame.xml
step4:该应用的布局文件 res/layout/main.xml
step5:该应用的主文件,FrameActivity.java
效果如下:
==================================下面看一个gif动画===========================================
=================================================================================================
作者:欧阳鹏 欢迎转载,与人分享是进步的源泉!
==================================================================================================