Frame 动画,即顺序播放事先做好的图像,跟电影类似。
接下来的案例是点击按钮实现播放动画,点击停止实现停止动画播放!
1、效果图:

2、main.xml文件很简单:
4、最后是java代码:
An object used to create frame-by-frame animations, defined by a series of Drawable objects, which can be used as a View object's background.
The simplest way to create a frame-by-frame animation is to define the animation in an XML file, placed in the res/drawable/ folder, and set it as the background to a View object. Then, call start() to run the animation.
An AnimationDrawable defined in XML consists of a single element, and a series of nested tags. Each item defines a frame of the animation.