开发者

How can I find out when a gesture has finished

开发者 https://www.devze.com 2023-02-16 05:16 出处:网络
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.

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消