如何从android的TextView上下文菜单中删除输入法
我的 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
menu.removeItem(android.R.id.switchInputMethod);
怎么样?How about
menu.removeItem(android.R.id.switchInputMethod);
?我很确定这是不可能的,如果安装了多个键盘,输入法就是用户更改当前 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.