【帧动画总结】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中定义动画 < ...
随机推荐
- java项目建立流程
spring mvc 书籍Spring in Action, 4th Edition java项目建立流程 1 使用maven来管理项目中的库.先用marven建立一个框架mvn archetype: ...
- Django学习笔记-2018.11.17
URL配置: 项目下的urls.py配置的为URL总路径,在使用第二种方法在app下配置的urls.py是在总路径下的分路径 Templates: DTL初步使用 render()函数支持dict类型 ...
- [GYM 100492A] Average Convex Hull 凸包好题
大致题意: 给出一个点集,其中有一个点有相同的几率会被删除,求删除之后的点集够成的凸包上的点的平均数. 首先看到题目,可以考虑枚举删除的点,将其凸包上前后两点以及两点间凸包内所有点构建凸包,因为凸包内 ...
- STM32使用定时器实现输入捕获
输入捕获简介输入捕获模式可以用来测量脉冲宽度或者测量频率.STM32的定时器,除了TIM6和TIM7,其他定时器都有输入捕获功能. STM32的输入捕获,简单地说就是通过检测TIMx_CHx上的边沿信 ...
- python升级带来的yum异常:File "/usr/bin/yum", line 30
问题: $ yum File "/usr/bin/yum", line 30 except KeyboardInterrupt, e: ^ SyntaxError: invalid ...
- 在 HTTP Request 中加入特定的 Header
转:http://www.findspace.name/easycoding/1137 要加入 header,需要使用 Request 对象: #code1 import urllib2 reques ...
- 深入理解javascript作用域系列第四篇
前面的话 尽管函数作用域是最常见的作用域单元,也是现行大多数javascript最普遍的设计方法,但其他类型的作用域单元也是存在的,并且通过使用其他类型的作用域单元甚至可以实现维护起来更加优秀.简洁的 ...
- 【BFS】【枚举】HihoCoder - 1251 - The 2015 ACM-ICPC Asia Beijing Regional Contest - C - Today Is a Rainy Day
题意:给你两个只由1~6组成的串,问你B串至少要经过几次操作变成A串. 一次操作要么选择一个种类的数,将其全部变成另一种类:要么选择一个数,将其变为另一个数. 可以证明,一定先进行一定数量的第一种操作 ...
- nginx fastcgi_buffers to an upstream response is buffered to a temporary file
fastcgi_buffers 16 16k; 指定本地需要用多少和多大的缓冲区来缓冲FastCGI的应答,如上所示,如果一个php脚本所产生的页面大小为256k,则会为其分配16个16k的缓冲区来缓 ...
- CXF和Axis2开发webservice也是可以添加asmx等后缀
在当家互联网时代, 手机APP所需要的后台服务接口经常会变化, 如果前期没有设计好, 把它们的请求地址配置在比较稳定不会经常修改的地址(例如专门一个后台服务用于获取所有最新的数据服务地址)这样不会因为 ...