Anh*_*ddy 5 android android-input-method
我的应用程序需要同时激活两个输入源:条形码扫描器和软键盘.当我配对蓝牙扫描仪时,它被视为物理键盘.因此,连接此设备时,不显示软键盘(软键盘已停用).
是否可以同时激活物理键盘和软键盘?如果没有,解决问题的最佳方法是什么?我是否必须实现一个自定义视图来下载按键事件?市场上是否有任何键盘应用程序可以做到这一点?
我如何以编程方式打开和关闭物理键盘?这是切换按钮"使用物理键盘"设置(我在此处找到了此设置的屏幕截图:

小智 1
物理键盘和软键盘无法同时处于活动状态。它由 InputMethodService 函数强制执行onEvaluateInputViewShown。你可以在这里查看文档。
/**
* Override this to control when the soft input area should be shown to
* the user. The default implementation only shows the input view when
* there is no hard keyboard or the keyboard is hidden. If you change what
* this returns, you will need to call {@link #updateInputViewShown()}
* yourself whenever the returned value may have changed to have it
* re-evaluated and applied.
*/
public boolean onEvaluateInputViewShown() {
Run Code Online (Sandbox Code Playgroud)
因此,除非您正在实现自己的 IME,其中您可以覆盖 onEvaluateInputViewShown,否则不可能同时激活物理键盘和软键盘。
关于你的最后一个问题,我不确定,但我认为没有办法以编程方式隐藏硬键盘。虽然它没有解决方案,但你应该检查这个问题
| 归档时间: |
|
| 查看次数: |
1425 次 |
| 最近记录: |