【帧动画总结】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中定义动画 < ...
随机推荐
- 【caffe-Windows】微软官方caffe之matlab接口配置,以及安装caffe的注意事项
1.在此之前,记录一下之前的错误,在参考博客[caffe-Windows]caffe+VS2013+Windows+GPU配置+cifar使用进行caffe的安装时,其中的一些步骤可以不做,具体见下图 ...
- MVC Partial页面的使用
先建立Action: public PartialViewResult CurrentCount() { ViewBag.Count = CurrentUserCount; return Partia ...
- CentOS 7安装Mysql并设置开机自启动的方法
CentOS 7不带Mysql数据库了,默认的数据库是MariaDB(Mysql的一个分支). 可以按照以下步骤手动安装Mysql数据库. 1. 下载rpm安装文件 ? 1 wget http://r ...
- thinkphp5.0架构总览
ThinkPHP5.0应用基于MVC(模型-视图-控制器)的方式来组织. MVC是一个设计模式,它强制性的使应用程序的输入.处理和输出分开.使用MVC应用程序被分成三个核心部件:模型(M).视图(V) ...
- Eclipse项目红色叹号解决方法
情况:就是项目出现红色感叹号 解决方法: 对准项目右键选择Build Path → configure build path 点击eclipse项目的configure build path后,在弹出 ...
- XSS漏洞自动化攻击工具XSSer
XSS漏洞自动化攻击工具XSSer XSS是Web应用常见的漏洞.利用该漏洞,安全人员在网站注入恶意脚本,控制用户浏览器,并发起其他渗透操作.XSSer是Kali Linux提供的一款自动化XSS ...
- Prime Number CodeForces - 359C (属于是数论)
Simon has a prime number x and an array of non-negative integers a1, a2, ..., an. Simon loves fracti ...
- [BZOJ4032][HEOI2015]最短不公共子串(Trie+DP)
在虐各种最长公共子串.子序列的题虐的不耐烦了之后,你决定反其道而行之——被它们虐. 操作一:对A,B分别建SAM,暴力BFS. 操作二:对B建序列自动机或SAM,A在上面暴力匹配. 操作三:对A,B建 ...
- Codeforces Round #346 (Div. 2) G. Fence Divercity dp
G. Fence Divercity 题目连接: http://www.codeforces.com/contest/659/problem/G Description Long ago, Vasil ...
- UESTC 2015dp专题 N 导弹拦截 dp
导弹拦截 Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://acm.uestc.edu.cn/#/contest/show/65 Descrip ...