Animation和AnimationSet中参数的使用

API level 16
The way that AnimationSet inherits behavior from Animation is important to understand. Some of the Animation attributes applied to AnimationSet affect the AnimationSet itself, some are pushed down to the children, and some are ignored, as follows:
1:duration, repeatMode, fillBefore, fillAfter: These properties, when set on an AnimationSet object, will be pushed down to all child animations.
2:repeatCount, fillEnabled: These properties are ignored for AnimationSet.
3:startOffset, shareInterpolator: These properties apply to the AnimationSet itself.
Starting with ICE_CREAM_SANDWICH, the behavior of these properties is the same in XML resources and at runtime (prior to that release, the values set in XML were ignored for AnimationSet). That is, calling setDuration(500) on an AnimationSet has the same effect as declaring android:duration="500" in an XML resource for an AnimationSet object.
主要意思:
由于AnimationSet继承自Animation,所以Animation中的一些参数会影响到AnimationSet,但是有的被忽略,如下
1、duration, repeatMode, fillBefore, fillAfter:在AnimationSet中设置有效,并且会作用到该AnimationSet中包含的所有Animation
2、repeatCount, fillEnabled:在AnimationSet中设置无效,不会作用于到该AnimationSet中包含的所有Animation
3、startOffset, shareInterpolator: 在AnimationSet中设置有效,但是不会作用到该AnimationSet中包含的所有Animation
从ICE_CREAM_SANDWICH(Android4.0)开始,在xml和在代码中使用这些参数,效果是一致的。

猜你喜欢

转载自lxdyycg.iteye.com/blog/1747056
今日推荐