How can I find out when a gesture has finished
Is there a possibility for Android to detect if an gesture (swipe, zooming, etc.) has finished?
I need that in the onDraw
method of my ImageView
to optim开发者_JAVA技巧ize the performance.
Thanks!
You could extend LinearLayout
or whatever ViewGroup you are using. Then you can override the onTouchEvent()
of your Base-class or if you need more control over the Event you can override onInterceptTouchEvent()
method. In these method you have Access to a MotionEvent
.
Then you can use GestureDetector to detect any Gestures related to the MotionEvent.
Usually you would use this to do anything magical with the gesture and let your app react on the gesture. But you can use it in your case to know then a gesture has finished.
Hope that helps.
精彩评论