Gesture Detector not working

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-03 11:38:37

onDown() must return true even if you don't want to react to that event, or else it will make the detector discard any following event and hence any gesture.

Shashank Tomar

Whether or not you use GestureDetector.OnGestureListener, it's best practice to implement an onDown() method that returns true. This is because all gestures begin with an onDown() message. If you return false from onDown(), as GestureDetector.SimpleOnGestureListener does by default, the system assumes that you want to ignore the rest of the gesture, and the other methods of GestureDetector.OnGestureListener never get called. This has the potential to cause unexpected problems in your app. The only time you should return false from onDown() is if you truly want to ignore an entire gesture.

http://developer.android.com/training/gestures/detector.html#detect

Sin Sangdo
[view].setLongClickable(true);

This must be called first.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!