【帧动画总结】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中定义动画 < ...
随机推荐
- SaltStack的salt-ssh使用及LAMP状态设计部署(五)
一.salt-ssh的使用 官方文档:https://docs.saltstack.com/en/2016.11/topics/ssh/index.html (1)安装salt-ssh [root@l ...
- 什么是泛型 转载自http://www.blogjava.net/Jack2007/archive/2008/05/05/198566.html
我们在编写程序时,经常遇到两个模块的功能非常相似,只是一个是处理int数据,另一个是处理string数据,或者其他自定义的数据类型,但我们没有办法,只能分别写多个方法处理每个数据类型,因为方法的参数类 ...
- CodeForces 785A Anton and Polyhedrons
简单判断. 分别判断每个单词是几面体,加起来就是答案. #include <cstdio> #include <cmath> #include <cstring> ...
- Python之路【第五篇】: 函数、闭包、装饰器、迭代器、生成器
目录 函数补充进阶 函数对象 函数的嵌套 名称空间与作用域 闭包函数 函数之装饰器 函数之可迭代对象 函数之迭代器 函数之生成器 面向过程的程序设计思想 一.函数进阶之函数对象 1. 函数对象 秉承着 ...
- 网页后门工具laudanum
网页后门工具laudanum laudanum是Kali Linux预先安装的Web Shell工具.它支持多种Web后台技术,如ASP.ASP.net .JSP.PHP.Coldfusion.它提 ...
- [JSOI2007]文本生成器 --- AC自动机 + DP
[JSOI2007]文本生成器 题目描述: JSOI交给队员ZYX一个任务,编制一个称之为“文本生成器”的电脑软件:该软件的使用者是一些低幼人群,他们现在使用的是GW文本生成器v6版. 该软件可以随机 ...
- [SDOI2015]约数个数和 --- 简单反演
求\(\sum\limits_{i=1}^{n}\sum\limits_{j=1}^{m}d(ij)\) 不知道怎么讲..... 首先考虑\(d(ij)\)究竟是什么 首先,很自然地想到,既然是求\( ...
- 【树上主席树】BZOJ2588-Count on a tree
[题目大意] 给定一棵N个节点的树,每个点有一个权值,对于M个询问(u,v,k),你需要回答u xor lastans和v这两个节点间第K小的点权.其中lastans是上一个询问的答案,初始为0,即第 ...
- Unity随手机
该文章持续更新! 协程的返回值必需是 IEnumerator 协程的参数不能加关键字 ref 或 out 在函数 Update 和 FixedUpdate 中不能使用 yield 语句,但可以启动协程 ...
- ORACEL 创建表空间
注意点: 1.如果在PL/SQL 等工具里打开的话,直接修改下面的代码中[斜体加粗部分]执行 2.确保路径存在,比如[D:\oracle\oradata\Oracle9i\]也就是你要保存文件的路径存 ...