android - 检测虚拟键盘类型-android

标签 android android-softkeyboard android-virtual-keyboard

<分区>

我有一个 android 应用程序,它处理来自标准键盘的输入与 Swype 键盘提供的输入不同。有没有办法以编程方式找出当前正在使用的键盘?

谢谢!

最佳答案

获得它的最佳方法是使用 InputDeviceId。

int[] devicesIds = InputDevice.getDeviceIds();
for (int deviceId : devicesIds) {
    //Check the device you want
    InputDevice device = InputDevice.getDevice(deviceId);
    //device.getName must to have virtual
    //That check the keyboard type
    device.getKeyboardType(); //returns an int
}

引用:

https://developer.android.com/reference/android/view/InputDevice.html#getKeyboardType%28%29

关于android - 检测虚拟键盘类型-android,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16065948/

相关文章:

android - 手势输入是 AOSP LatinIME 的一部分吗?

android - EditText onClick 不显示虚拟键盘

android - 使用 BACK 键的键盘隐藏事件

javascript - 在Webview/UIWebView中加载外部URL时,是否可以加载本地JS文件?

android - 将 Android 应用程序的主 Activity 切换为其他名称后为 "App not installed"

android - Android fragment 中的谷歌地图

长按Android自定义键盘弹出键盘

java - 在软键盘 android 上收听每个按键事件

java - 使用 detachChild() 和 addChild() 时循环未按预期执行

android - 如何在代码中禁用物理键盘(一直使用虚拟键盘)