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

查看:21
本文介绍了如何向 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天全站免登陆