简体   繁体   中英

Android EditText Select Text

I have overridden the

OnLongClickListener

of the Android:EditText in order to show my own menu. However I would still like the user to be able to "select text" and "select all" from a button within my custom menu, how should I go about doing that?

EDIT: Sorry I should have put more detail in my question.

I have tried the selectAll() method for selecting the text however this doesn't come up with the two pointers (where the user can drag to select areas) which is what I mean by select text.

按下自定义按钮时,使用findViewBy id查找该EditText,然后使用以下功能:

((EditText)v).selectAll();

在“ 相关”列中,我发现“ 编辑文本”在获得焦点时选择了所有文本 ,这很容易适应上下文菜单,您也可能会在此找到“选择单词”策略。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM