如何在双击时隐藏文本选择工具菜单?

How to hide text selection tool menu in double click?

我们知道setTextIsSelectable()是用来select的text.So当我们长按文本selection工具菜单出现(copy/paste菜单) .

如果我们双击文本视图,也会出现菜单选项。

我想知道如何隐藏双击菜单?

注意:我需要文本始终 selectable。

这是你必须做的:

setTextIsSelectable

When you call this method to set the value of textIsSelectable, it sets the flags focusable, focusableInTouchMode, clickable, and longClickable to the same value. These flags correspond to the attributes android:focusable, android:focusableInTouchMode, android:clickable, and android: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() or setLongClickable().

来源:https://developer.android.com/reference/android/widget/TextView.html#setTextIsSelectable(boolean)

当文本可选择时android 将双倍显示文本选择菜单tap.To 禁用此问题我们需要实现GestureDetector 使用 onTouch。然后在 GestureListener 中设置 setTextIsSelectable(true) in onLongPresssetTextIsSelectable(false) in 双击.