如何通过触摸控制动画 [英] How to control an animation via touch
问题描述
我正在创建一个使用磁盘浏览文件的应用程序,例如: http://dl.dropbox.com/u/8051037/disk_ab1.png
I'm creating an app that uses a disk to browse files and such, like this: http://dl.dropbox.com/u/8051037/disk_ab1.png
我想让它能够随着用户旋转而旋转,而且我知道我需要使用RotateAnimation,但是我不知道如何使其顺着手指滑动.
I want to make it be able to spin as the user turns it, and I know I need to use a RotateAnimation, but I can't figure out how to make it follow the finger.
推荐答案
I think you should use a custom view, see this examle which rotates a ball: How can I use the animation framework inside the canvas?
then you can use motion event to control the angle of rotation: Android firing onTouch event for multiple ImageViews
自定义视图可以是透明的,因此您可以将其与布局中的其他样式结合起来.
Custom view can be transparent so you can combine it with other veiws in your layout.
这篇关于如何通过触摸控制动画的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!