您的位置:首页 > 其它

关于AnimationSet无法循环的小结

2015-11-09 00:53 253 查看
主要就是android:repeatCount,android:repeatMode无效。这个问题据说是Google的工程师刻意为之。替代方案是用属性动画,AnimatorSet的方式。

The attributes that were ignored in XML now work, with the exception of 
repeatCount
 and 
fillEnabled
 which
are still ignored (on purpose for some reason). This means it still isn't easy to repeat an 
AnimationSet
unfortunately.To
expand upon answers by Pavel and others: it is true that the 
<set>
 tag
is ridiculously buggy. It can't deal correctly with 
repeatCount
 and
a number of other attributes.

附带:Animation与AnimatorSet区别

简介:
AnimatorSet 和 AnimationSet 都是动画集合。这里简单介绍下他们的异同,了解这些后在设计动画实现时才能得心应手。 
AnimationSet 我们最常用的是调用其 addAnimation 将一个个不一样的动画组织到一起来,然后调用view 的 startAnimation 方法触发这些动画执行。功能较弱不能做到把集合中的动画按一定顺序进行组织然后在执行的定制。 

AnimatorSet 我们最常用的是调用其play、before、with、after 等方法设置动画的执行顺序,然后调用其start 触发动画执行。 

AnimationSet 与 AnimatorSet 最大的不同在于,AnimationSet 使用的是 Animation 子类、AnimatorSet 使用的是 Animator 的子类。 

Animation 是针对视图外观的动画实现,动画被应用时外观改变但视图的触发点不会发生变化,还是在原来定义的位置。 

Animator  是针对视图属性的动画实现,动画被应用时对象属性产生变化,最终导致视图外观变化。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息