Android:如何使视图的位置与动画后的视觉表示相匹配
我目前正在尝试使用平移和旋转动画的动画集来制作纸牌游戏的动画。尽管我使用 setFillAfter(true) 并看到卡片明显移动并停留在新位置,但 ImageView 的实际位置仍位于旧位置。
在 Google 文档中它说:
注意:无论您的动画如何移动或调整大小,保存动画的视图的边界都不会自动调整以适应它。即便如此,动画仍然会超出其 View 的边界绘制,并且不会被裁剪。但是,如果动画超出父视图的边界,就会发生裁剪。
这意味着我所有旧的 onClickListeners 等仍然与旧位置而不是新更新的视觉表示相关联,并且应用于视图的任何新动画都从初始位置发生,而不是新定位的位置。
获得我所寻求的效果的最佳方法是什么(一张卡片从我的手滑到屏幕中心,这是一个不同的 LinearLayout,然后在稍后的序列中从该位置滑出屏幕)?
我知道我所寻求的是可能的,因为 bytesequencing.com 的人们已经在我在市场上发现的 Android 游戏“Hearts!(免费)”中实现了这种流畅的动画效果。
谢谢!
I am currently trying to animate a card game using an AnimationSet of Translate and Rotate animations. Although I am using setFillAfter(true) and see the card visibly move and stay in it's new position, the actual position of the ImageView is still at it's old location.
In the Google documentation it says:
Note: Regardless of how your animation may move or resize, the bounds of the View that holds your animation will not automatically adjust to accommodate it. Even so, the animation will still be drawn beyond the bounds of its View and will not be clipped. However, clipping will occur if the animation exceeds the bounds of the parent View.
This means that all of my old onClickListeners, etc are still being associated with the old position rather than the newly updated visual representation, and any new animation applied to the View occur from the initial spot, not the newly located one.
What is the best way to get the effect that I seek (a card sliding from my hand to the center of the screen, which is a different LinearLayout, and then in a later sequence sliding from that spot off the screen)?
I know what I seek is possible as the people at bytesequencing.com have accomplished this smooth animation effect in their android game "Hearts! (free)" which I discovered in the market.
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论