Android 属性动画和View动画的特别之处

动画一些比较特殊的地方:

   1. 属性动画完成之后. 

       1)没有改变的是:View的getLocalVisibleRect(), getLeft()等的值并没有没有改变。

       2)改变的是:getLocationInWindow,getLocationOnScreen等的值已经改变。

动画开始前获取的动画View位置:

01-08 10:52:11.123 25853-25853/com.example.lvtingbo.devartcharpter3 D/AnimationActivity: showPosInfo index=1
01-08 10:52:11.123 25853-25853/com.example.lvtingbo.devartcharpter3 D/AnimationActivity: showPosInfo, getLocationInWindow location[0]=32 location[1]=210
01-08 10:52:11.123 25853-25853/com.example.lvtingbo.devartcharpter3 D/AnimationActivity: showPosInfo, getLocationOnScreen location[0]=32 location[1]=210
01-08 10:52:11.123 25853-25853/com.example.lvtingbo.devartcharpter3 D/AnimationActivity: showPosInfo, getLocalVisibleRect rect=Rect(0, 0 - 192, 43)
01-08 10:52:11.123 25853-25853/com.example.lvtingbo.devartcharpter3 D/AnimationActivity: showPosInfo, getGlobalVisibleRect rect=Rect(32, 210 - 224, 253)
01-08 10:52:11.123 25853-25853/com.example.lvtingbo.devartcharpter3 D/AnimationActivity: showPosInfo, getLeft()=32 getTop()=32 getRight()=224 getBottom()=75

动画结束后获取的动画view位置:
01-08 10:52:16.137 25853-25853/com.example.lvtingbo.devartcharpter3 D/AnimationActivity: showPosInfo index=2 onAnimationEnd
01-08 10:52:16.138 25853-25853/com.example.lvtingbo.devartcharpter3 D/AnimationActivity: showPosInfo, getLocationInWindow location[0]=832 location[1]=210
01-08 10:52:16.138 25853-25853/com.example.lvtingbo.devartcharpter3 D/AnimationActivity: showPosInfo, getLocationOnScreen location[0]=832 location[1]=210
01-08 10:52:16.138 25853-25853/com.example.lvtingbo.devartcharpter3 D/AnimationActivity: showPosInfo, getLocalVisibleRect rect=Rect(0, 0 - 192, 43)
01-08 10:52:16.139 25853-25853/com.example.lvtingbo.devartcharpter3 D/AnimationActivity: showPosInfo, getGlobalVisibleRect rect=Rect(832, 210 - 1024, 253)
01-08 10:52:16.139 25853-25853/com.example.lvtingbo.devartcharpter3 D/AnimationActivity: showPosInfo, getLeft()=32 getTop()=32 getRight()=224 getBottom()=75

  2. View动画,动画完成之后,如果设置了fillAfter(true)则view会停留在完成之后的位置,但是点击事件是View原始的位置起作用。

    对应的View动画,上面几个值都没有发生改变。

01-08 10:58:02.511 32227-32227/com.example.lvtingbo.devartcharpter3 D/AnimationActivity: showPosInfo index=1before start view animation
01-08 10:58:02.511 32227-32227/com.example.lvtingbo.devartcharpter3 D/AnimationActivity: showPosInfo, getLocationInWindow location[0]=32 location[1]=210
01-08 10:58:02.511 32227-32227/com.example.lvtingbo.devartcharpter3 D/AnimationActivity: showPosInfo, getLocationOnScreen location[0]=32 location[1]=210
01-08 10:58:02.511 32227-32227/com.example.lvtingbo.devartcharpter3 D/AnimationActivity: showPosInfo, getLocalVisibleRect rect=Rect(0, 0 - 192, 43)
01-08 10:58:02.511 32227-32227/com.example.lvtingbo.devartcharpter3 D/AnimationActivity: showPosInfo, getGlobalVisibleRect rect=Rect(32, 210 - 224, 253)
01-08 10:58:02.511 32227-32227/com.example.lvtingbo.devartcharpter3 D/AnimationActivity: showPosInfo, getLeft()=32 getTop()=32 getRight()=224 getBottom()=75
01-08 10:58:08.523 32227-32227/com.example.lvtingbo.devartcharpter3 D/AnimationActivity: showPosInfo index=1onAnimationEnd view animation
01-08 10:58:08.523 32227-32227/com.example.lvtingbo.devartcharpter3 D/AnimationActivity: showPosInfo, getLocationInWindow location[0]=32 location[1]=210
01-08 10:58:08.523 32227-32227/com.example.lvtingbo.devartcharpter3 D/AnimationActivity: showPosInfo, getLocationOnScreen location[0]=32 location[1]=210
01-08 10:58:08.524 32227-32227/com.example.lvtingbo.devartcharpter3 D/AnimationActivity: showPosInfo, getLocalVisibleRect rect=Rect(0, 0 - 192, 43)
01-08 10:58:08.524 32227-32227/com.example.lvtingbo.devartcharpter3 D/AnimationActivity: showPosInfo, getGlobalVisibleRect rect=Rect(32, 210 - 224, 253)
01-08 10:58:08.524 32227-32227/com.example.lvtingbo.devartcharpter3 D/AnimationActivity: showPosInfo, getLeft()=32 getTop()=32 getRight()=224 getBottom()=75

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值