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和在代码中使用这些参数,效果是一致的。
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值