Search code examples
androidtextviewonclicklistenercopy-pastetextselection

How to hide text selection tool menu in double click?


We know that setTextIsSelectable() is used to select the text.So when we long press the text selection tool menu appear (copy/paste menu).

If we double click on the textview also the menu option appear.

I would like to know how to hide the menu in double click ?

NB:I need the text is always selectable.


Solution

  • When text is selectable android will show the text selection menu in double tap.To disable this problem we need to implement GestureDetector with onTouch. Then in the GestureListener set setTextIsSelectable(true) in onLongPress and setTextIsSelectable(false) in double tap.