如何向Android的本机“编辑文本"上下文菜单添加选项 [英] How to add options to Android's native 'Edit text' context menu

查看:105
本文介绍了如何向Android的本机“编辑文本"上下文菜单添加选项的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以在用户长按任何编辑文本"时在显示的项目列表中添加一些内容? (剪切,复制粘贴,选择文本,全部选择,输入法)我想在此菜单中添加另一个选项,但无法弄清楚.

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 :)

推荐答案

是否可以在用户长按任何编辑文本"时在显示的项目列表中添加一些内容?

Is it possible to add something to the list of items that shows up when a user long presses on any Edit Text?

如果您的活动中是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.

这里有一个重复的问题,第一个答案的最后一条评论说这是可能的,但不是很漂亮".然后线程死亡.

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.

首先,该帖子已有两年历史,在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的本机“编辑文本"上下文菜单添加选项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆