问题描述
是否可以在用户长按任何编辑文本"时在显示的项目列表中添加一些内容? (剪切,复制粘贴,选择文本,全部选择,输入法)我想在此菜单中添加另一个选项,但无法弄清楚.
Is it possible to add something to the list of items that shows up when a user long presses on any Edit Text? (Cut, copy paste, select text, select all, input method) I want to add another option to this menu, but cannot figure it out.
在此处重复此问题,并且第一个答案的最后评论说,这可能,但并不漂亮".然后线程死亡.
There is a duplicate of this question here, and the last comment for the first answer says it's 'possible, but not pretty'. Then the thread dies.
我真的很想看看任何可行的示例,无论是否肮脏:)
I'd really like to see any working example, dirty or not :)
推荐答案
如果您的活动中是EditText
,则可以通过onCreateContextMenu()
进行.
If the EditText
is in your activity, you can do that via onCreateContextMenu()
.
如果EditText
不在您的活动中,则否.
If the EditText
is not in your activity, then no.
首先,该帖子已有两年历史,在Android时代几乎永远存在.
First, that post is two years old, which is nearly forever in Android years.
第二,我可以肯定地说,哈瑟曼先生的评估是不正确的.
Second, I am fairly certain Mr. Haseman is incorrect in his assessment.
这篇关于如何向Android的本机“编辑文本"上下文菜单添加选项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!