android - 如何切换 "Use Physical Keyboard"。

标签 android toggle rfid virtual-keyboard

我正在开发一个应用程序,其中我有 RFID 阅读器(模拟键盘)。在某些 Activity 中,我也需要虚拟键盘。我发现我所需要的只是切换“使用物理键盘”。这工作正常,但当我重新启动我的平板电脑时,此功能设置为默认值?

是否可以,如果我可以在我的代码中的某处插入一个切换按钮?

最佳答案

我能够使用以下代码切换屏幕键盘:

InputMethodManager inputMgr = (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
inputMgr.toggleSoftInput(0, 0);

在引用中,使用EditText .

“EditText 是 TextView 的一个薄层,将自身配置为可编辑。”

要显示屏幕键盘,他们只需触摸文本框即可。如果该框被命名为“搜索”或类似名称,我相信它对用户来说会比按钮更有用。

关于android - 如何切换 "Use Physical Keyboard"。,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11878153/

相关文章:

Android 和 Jsoup

java - Jackson Mapper 在三星 SM-T580 上抛出 "conflicting setter definitions"

javascript - 关闭和事件

Android 和 Symbian NFC 移动开发问答(FAQ)

android - 在Android上读取RFID标签并在网页中插入数据

java - Jackson 数组到 Pojo 只能在 Android 上运行

android - 如何更改android中单选按钮的边框颜色?

jquery - 切换缓存/cookie

javascript - jQuery 切换菜单,在外部单击时隐藏下拉内容

android - Nexus 7 2013 检测效果最好的 NFC/RFID 卡