catch double click on textview android

后端 未结 4 977
孤独总比滥情好
孤独总比滥情好 2021-01-21 03:33

i want to catch double click on textview for that i have used below code

but it still not working :(

TextView txtOne;

@Override
protected void onCreate(         


        
4条回答
  •  滥情空心
    2021-01-21 03:36

    For SimpleGestureDetector, you need to override onDown() and return true to trigger double tap detector.

    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.

    Source: http://developer.android.com/training/gestures/detector.html

提交回复
热议问题