【转】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 ...
随机推荐
- WinFrom ProgressBar控件的使用
在WinForm程序中,大多数情况下我们是知道程序运行所需要的时间或步骤的,比如批量复制文件时文件的数量,数据导出或导入时数据的总行数等等.对于步骤比较确定的操作,如果程序执行过程时间较长,很容易使用 ...
- 一. 什么是ANR?为什么会有ANR发生?
对于Android平台的工程师来说,ANR应该是每个人都会遇到的问题,因为导致它的原因有很多,例如在主线程进行耗时操作,调用大量cpu资源进行复杂的预算等,并且可能在大多数情况下,这类问题不会发生,只 ...
- 简单安装python的pip工具模块
下载最新pip安装包 https://pypi.python.org/pypi/pip#downloads 安装 .tar.gz cd pip-.tar.gz python setup.py inst ...
- C语言实现五子棋简单功能
/******************************************************************** C-4.29-1: 实现五子棋游戏 操作说明:用方向键或者& ...
- PyCharm如何设置显示行号?
File->setting->Editor->General->Appearance,勾选Show line numbers
- Hadoop下各技术应用场景
数据采集和DataFlow 对于数据采集主要分为三类,即结构化数据库采集,日志和文件采集,网页采集.对于结构化数据库,采用Sqoop是合适的,可以实现结构化数据库中数据并行批量入库到hdfs存储.对于 ...
- Early 80386 CPUs
Assembling a detailed and accurate history of the 80386, including a complete listing of all the &qu ...
- Jamie's Contact Groups
poj2289:http://poj.org/problem?id=2289 题意:给定一个规模为n的名单,要将名单中的人归到m个组中,给出每个人可能的分组号,需要确定一种分配方案,是的最大规模的组最 ...
- Android 两个Activity进行数据传送 发送
Activity1:: Intent intent= new Intent(this, OtherActivity.class); String name = "heyiyong" ...
- 【POJ1021】Intervals (最短路解差分约束)
题目: Sample Input 5 3 7 3 8 10 3 6 8 1 1 3 1 10 11 1 Sample Output 6 题意: 我们选数,每个数只能选一次.给定n个条件[ai,bi]和 ...