Reputation: 2362
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.
Upvotes: 3
Views: 1226
Reputation: 2362
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.
Upvotes: 2
Reputation: 6142
Here is what you have to do:
setTextIsSelectable
When you call this method to set the value of
textIsSelectable
, it sets the flagsfocusable
,focusableInTouchMode
,clickable
, andlongClickable
to the same value. These flags correspond to the attributesandroid:focusable
,android:focusableInTouchMode
,android:clickable
, andandroid:longClickable
. To restore any of these flags to a state you had set previously, call one or more of the following methods:setFocusable()
,setFocusableInTouchMode()
,setClickable()
orsetLongClickable()
.
Source: https://developer.android.com/reference/android/widget/TextView.html#setTextIsSelectable(boolean)
Upvotes: -1