如何从android的TextView上下文菜单中删除输入法

发布于 2024-09-29 20:02:58 字数 345 浏览 0 评论 0原文

我的 TextView 上有一个上下文菜单,代表我的应用程序中的用户名。当上下文菜单出现时,我想要某些选项,例如查看统计信息等。上下文菜单显示正常,除了它将输入法添加到上下文菜单,但我不希望它在那里。这与上下文菜单的用途无关,并且没有文本输入。如何从上下文菜单中删除此项?我尝试删除上下文菜单中的 item 0 并添加

android:editable="false"

XML 文件中,但无济于事。有什么想法吗?

I have a context menu on a TextView representing a user name in my app. When the context menu appears I want to have certain options such as View Statistics etc. The context menu is appearing fine and everything is working great except it's adding Input method to the context menu and I do not want it there. It's irrelevant to what the context menu is there for and there is not text entry. How can I remove this item from the context menu? I've tried removing item 0 in the context menu and adding

android:editable="false"

to the XML file to no avail. Any ideas?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

情泪▽动烟 2024-10-06 20:02:58

menu.removeItem(android.R.id.switchInputMethod);怎么样?

How about menu.removeItem(android.R.id.switchInputMethod);?

若能看破又如何 2024-10-06 20:02:58

我很确定这是不可能的,如果安装了多个键盘,输入法就是用户更改当前 IME(软键盘)的方式。它是一个全球环境。

Im pretty sure that isn't possible, the input method is how the user changes the current IME (soft keyboard) if the have multiple keyboards installed. Its a global setting.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文