【转】setAnimation和startAnimation区别
http://stackoverflow.com/questions/10909865/setanimation-vs-startanimation-in-android
http://blog.csdn.net/wyhuan1030/article/details/7409869
设置一个动画播放这一观点。如果你想立即播放的动画,使用startAnimation这种方法提供了允许细粒度控制的起始时间和失效,
但你必须确保:1)动画开始时间 2)动画应该开始时的观点,将被视为无效。
- <span id="result_box" lang="zh-CN"></span>
- /**
- * Sets the next animation to play for this view.
- * If you want the animation to play immediately, use
- * startAnimation. This method provides allows fine-grained
- * control over the start time and invalidation, but you
- * must make sure that 1) the animation has a start time set, and
- * 2) the view will be invalidated when the animation is supposed to
- * start.
- *
- * @param animation The next animation, or null.
- */
- public void setAnimation(Animation animation) {
- mCurrentAnimation = animation;
- if (animation != null) {
- animation.reset();
- }
- }
现在开始指定的动画。
- /**
- * Start the specified animation now.
- *
- * @param animation the animation to start now
- */
- public void startAnimation(Animation animation) {
- animation.setStartTime(Animation.START_ON_FIRST_FRAME);
- setAnimation(animation);
- invalidateParentCaches();
- invalidate(true);
- }
建议使用
startAnimation来启动动画,setAnimation启动动画是需要条件的
【转】setAnimation和startAnimation区别的更多相关文章
- Android中res下anim和animator文件夹区别与总结
1.anim文件夹 anim文件夹下存放tween animation(补间动画)和frame animation(逐帧动画) 逐帧动画: ①在animation-list中使用item定义动画的全部 ...
- c#与java的区别
经常有人问这种问题,用了些时间java之后,发现这俩玩意除了一小部分壳子长的还有能稍微凑合上,基本上没什么相似之处,可以说也就是马甲层面上的相似吧,还是比较短的马甲... 一般C#多用于业务系统的开发 ...
- jquery和Js的区别和基础操作
jqery的语法和js的语法一样,算是把js升级了一下,这两种语法可以一起使用,只不过是用jqery更加方便 一个页面想要使用jqery的话,先要引入一下jqery包,jqery包从网上下一个就可以, ...
- 【原】nodejs全局安装和本地安装的区别
来微信支付有2年多了,从2年前的互联网模式转变为O2O模式,主要的场景是跟线下的商户去打交道,不像以往的互联网模式,有产品经理提需求,我们帮忙去解决问题. 转型后是这样的,团队成员更多需要去寻找业务的 ...
- 探究@property申明对象属性时copy与strong的区别
一.问题来源 一直没有搞清楚NSString.NSArray.NSDictionary--属性描述关键字copy和strong的区别,看别人的项目中属性定义有的用copy,有的用strong.自己在开 ...
- X86和X86_64和X64有什么区别?
x86是指intel的开发的一种32位指令集,从386开始时代开始的,一直沿用至今,是一种cisc指令集,所有intel早期的cpu,amd早期的cpu都支持这种指令集,ntel官方文档里面称为&qu ...
- Java中Comparable与Comparator的区别
相同 Comparable和Comparator都是用来实现对象的比较.排序 要想对象比较.排序,都需要实现Comparable或Comparator接口 Comparable和Comparator都 ...
- MySQL中interactive_timeout和wait_timeout的区别
在用mysql客户端对数据库进行操作时,打开终端窗口,如果一段时间没有操作,再次操作时,常常会报如下错误: ERROR (HY000): Lost connection to MySQL server ...
- 设置line-height:1.5和line-height:150%或者line-height:150px的区别
直接正题: 看一下line-height可能的值: 其实可以分为两类: (1)不带单位的(如line-height:1.5),这种是推荐使用的: (2)带单位的(如line-heigth:30px/1 ...
随机推荐
- 三十项调整助力 Ubuntu 13.04 更上一层楼
在Ubuntu 13.04 Raring Ringtail安装完成之后,我们还有三十项调整需要进行. 1.Ubuntu 13.04 Raring Ringtail安装完毕后,我又进行了一系列工作 大家 ...
- eclipse下使用Genymotion调试Android程序出现的问题
一. The connection to adb is down, and a severe error has occured. You must restart adb and Eclipse. ...
- 上传图片带预览功能兼容IE和火狐等主流浏览器
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...
- 用Xamarin和Visual Studio编写iOS App
一说开发 iOS app,你立马就会想到苹果的开发语言 Objective C/Swift 和 Xcode.但是,这并不是唯一的选择,我们完全可以使用别的语言和框架. 一种主流的替换方案是 Xamar ...
- js简版定时器
<html> <head> <meta http-equiv="Content-Type" content="text/html; char ...
- Android 网络通信 HTTP
摘要 1. Http GET 方法访问网站 2. Http POST访问网站 3. HttpClient进行Get方式通信 4. HttpClient进行Post方式通信 -------------- ...
- css格式化排版
1,文字排版--字体 语法: body{font-family:"Microsoft Yahei";} 这里注意不要设置不常用的字体,因为如果用户本地电脑上如果没有安装你设置的字体 ...
- 用typedef给结构体一个别名
转:typedef 一.用typedef给结构体一个别名 typedef struct tagMyStruct { int iNum; long lLength; } MyStruct; 这语句实际上 ...
- 转】VB中Set的用法
Set 语句 将对象引用赋给变量或属性. 语法 Set objectvar = {[New] objectexpression | Nothing} Set 语句的语法包含下面部分: 部分 描述 ob ...
- leetcode power(x,n)
class Solution { public: double pow(double x, int n) { double a=1; if(n==0)return 1; if(x==1)return ...