【帧动画总结】AnimationDrawable Frame
Drawable Animation 开发者文档
<animation-list xmlns:android="http://schemas.android.com/apk/res/android"
android:oneshot="true">
<item android:drawable="@drawable/rocket_thrust1" android:duration="200" />
<item android:drawable="@drawable/rocket_thrust2" android:duration="200" />
<item android:drawable="@drawable/rocket_thrust3" android:duration="200" />
</animation-list>
AnimationDrawable rocketAnimation;
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
ImageView rocketImage = (ImageView) findViewById(R.id.rocket_image);
rocketImage.setBackgroundResource(R.drawable.rocket_thrust);
rocketAnimation = (AnimationDrawable) rocketImage.getBackground();
}
public boolean onTouchEvent(MotionEvent event) {
if (event.getAction() == MotionEvent.ACTION_DOWN) {
rocketAnimation.start();
return true;
}
return super.onTouchEvent(event);
}
AnimationDrawable 类
继承体系
公共方法
- void addFrame(Drawable frame, int duration):Adds a frame to the animation
- int getDuration(int i):Return the duration in milliseconds of the frame at the specified index
- Drawable getFrame(int index):Return the Drawable at the specified frame index
- int getNumberOfFrames():Return the number of frames in the animation
- void inflate(Resources r, XmlPullParser parser, AttributeSet attrs, Resources.Theme theme):Inflate this Drawable from an XML resource optionally styled by a theme.
- boolean isOneShot():Return true of the animation will play once, false otherwise
- boolean isRunning():Indicates whether the animation is currently running or not.
- Drawable mutate():Make this drawable mutable易变的. This operation cannot be reversed反转.
- void run():This method exists for implementation purpose only and should not be called directly. Invoke start() instead.
- void setOneShot(boolean oneShot):Sets whether the animation should play once or repeat.
- boolean setVisible(boolean visible, boolean restart):Sets whether this AnimationDrawable is visible.
- void start():Starts the animation, looping if necessary. This method has no effect if the animation is running.
- void stop():Stops the animation. This method has no effect if the animation is not running.
- void unscheduleSelf(Runnable what):Use the current Drawable.Callback implementation to have this Drawable unscheduled.
帧动画简介
- 帧动画放在res/drawable文件夹中
- 补间动画放在res/anim文件夹中
- 属性动画放在res/animator文件夹中
【帧动画总结】AnimationDrawable Frame的更多相关文章
- android 帧动画的实现及图片过多时OOM解决方案(一)
一,animation_list.xml中静态配置帧动画的顺序,如下: <?xml version="1.0" encoding="utf-8"?> ...
- TimePicker控件、帧动画、补间动画
1.TimePicker控件 最近感觉每个开发平台的控件基本都差不多,在Android中控件的事件和.net控件直接写事件有一定的区别,net事件可以直接界面进行事件的绑定哈.不过在Silverlig ...
- Android开发(25)--framebyframe帧动画并实现启动界面到主界面的跳转
Drawable animation可以加载Drawable资源实现帧动画.AnimationDrawable是实现Drawable animations的基本类.推荐用XML文件的方法实现Drawa ...
- android中的逐帧动画
在android中实现动画最简单的一种方式就是使用逐帧动画(AnimationDrawable).逐帧动画的原理同最古老的动画机制是一样的,通过快速的播放一组变化微小的图片,在人眼的视差时间下,达到一 ...
- Android动画效果之Frame Animation(逐帧动画)
前言: 上一篇介绍了Android的Tween Animation(补间动画) Android动画效果之Tween Animation(补间动画),今天来总结下Android的另外一种动画Frame ...
- Android 学习笔记多媒体技术之 Drawable类+Tween(补间动画)+Frame(帧动画)
学习内容: 1.了解Drawable类的作用 2.如何使用Drawable... 3.了解Tween动画... 4.如何创建和使用Tween动画... 1.Drawable类... Drawabl ...
- Android动画主要包含补间动画(Tween)View Animation、帧动画(Frame)Drawable Animation、以及属性动画Property Animation
程序运行效果图: Android动画主要包含补间动画(Tween)View Animation.帧动画(Frame)Drawable Animation.以及属性动画Property Animatio ...
- Android动画总结#补间动画(Tween Animation/View Animation) #帧动画(Frame Animation/Drawable Animation)#属性动画(PropertyAnimation)
1.共有三种动画,英文名字多种叫法如下 第一种动画:补间动画(Tween Animation/View Animation) 四个:RotateAnimation旋转. AlphaAnimation透 ...
- 帧动画 AnimationDrawable
Drawable Animation(Frame Animation):帧动画,就像GIF图片,通过一系列Drawable依次显示来模拟动画的效果. 首先,在res/drawable中定义动画 < ...
随机推荐
- mongodb 32系统安装失败问题
32位系统 在安装完成后 运行mongod --dbpath c:\data\db后,没有如愿以偿出现端口数字27017,出现了如下的报错 ************** D:\GREENT~1\Pow ...
- spring-cloud学习BUG小结
1.com.sun.jersey.api.client.ClientHandlerException: java.net.ConnectException: Connection refused: c ...
- FastReport.Net使用:[30]对话框使用
使用对话框需要知道的地方 1.按钮的DialogResult属性. 假如DialogResult属性值为OK的按钮被点击,报表将会展现后面的对话框或者报表页:如果属性值为None,则停留在当前窗体: ...
- 「SCOI2014」方伯伯的商场之旅
「SCOI2014」方伯伯的商场之旅 题目描述 方伯伯有一天去参加一个商场举办的游戏.商场派了一些工作人员排成一行.每个人面前有几堆石子.说来也巧,位置在 \(i\) 的人面前的第 \(j\) 堆的石 ...
- POJ 3553 Light Switching Game 博弈论 nim积 sg函数
http://poj.org/problem?id=3533 变成三维的nim积..前面hdu那个算二维nim积的题的函数都不用改,多nim积一次就过了...longlong似乎不必要但是还是加上了 ...
- 【DLX算法】poj2676 Sudoku
DLX算法求解精确覆盖问题模板.赛场上可以参见白书. #include<cstdio> #include<cstring> #include<vector> usi ...
- [HihoCoder1169]猜单词
题目大意: 给你一个数列,问区间[l,r]内与k最接近的数与k的差是多少. 思路: 将数列中的数和询问的数先从小到大排序, 从小到大枚举每个数,如果是数列上的,就加到线段树中, 如果是询问中的,就在线 ...
- bzoj 3781
又忘了给每个点标所属的块,瞬间就变成一个块了. 写莫队一定要试一下随机极限数据. /********************************************************** ...
- php -- 解决php连接sqlserver2005中文乱码问题(附详细解决方法)
@_@~~ --php5.2 --phpstudy --apache --sqlserver2005 @_@~~问题描述 问题一:php连接sqlsever2005,输入中文,然后查询sqlserve ...
- CDOJ 1314 Hash Perfectly FFT
Hash Perfectly 题目连接: http://acm.uestc.edu.cn/#/problem/show/1314 Description In computing, a hash ta ...