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

来源:互联网 发布:php nodejs 共存 编辑:程序博客网 时间:2024/06/04 19:00

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

   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

0 0
原创粉丝点击