是否可以同时启用物理键盘和软键盘?
我的应用程序需要同时激活两个输入源:条形码扫描仪和软键盘。当我配对蓝牙扫描仪时,它被视为物理键盘。因此,当连接该设备时,不会显示软键盘(软键盘已停用)。
是否可以同时启用物理键盘和软键盘? 如果不是,解决问题的最佳方法是什么?我是否必须实现一个自定义视图来接收按键事件?市场上有任何键盘应用程序可以做到这一点吗?
如何以编程方式打开和关闭物理键盘?这是切换按钮“使用物理键盘”设置(我在这里找到了此设置的屏幕截图:
My Application needs to have two sources of input active at the same time: A bar-code scanner and the soft keyboard. When I pair a blue-tooth scanner, it is being treated as a physical keyboard. So, when this device is connected, the soft keyboard is not being displayed (soft keyboard is deactivated).
Is it possible to have both Physical Keyboard and Soft Keyboard active at the same time?
If not, what is the best approach towards solving the problem? Do I have to implement a custom View that sinks key press events? Is there any keyboard App on the Market that does this?
How do I, programatically, turn the Physical Keyboard On and Off? This is the toggle button 'Use Physical Keyboard' setting (I found the screenshot of this setting here:
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
物理键盘和软键盘无法同时处于活动状态。它由 InputMethodService 函数
onEvaluateInputViewShown
强制执行。您可以在此处查看文档 。因此,除非您正在实现自己的 IME,其中您可以覆盖 onEvaluateInputViewShown,否则不可能同时激活物理键盘和软键盘。
关于你的最后一个问题,我不确定,但我认为没有办法以编程方式隐藏硬键盘。虽然它没有解决方案,但您应该检查 这个问题
It is not possible to have both Physical Keyboard and Soft keyboard active at the same time. It is enforced by InputMethodService function
onEvaluateInputViewShown
. you can check the documentation here.So unless you are implementing your own IME wherein you can overide onEvaluateInputViewShown it is not possible to have both Physical and softkeyboard to be active at the same time.
Regarding your last question i am not sure but I think there is no way to programmatically hide the hardKeyboard. Though it doesn't have the solution you should check this question