如何以编程方式禁用/启用Android的物理键盘? [英] How do I programmatically disable/enable the physical keyboard in Android?

查看:1061
本文介绍了如何以编程方式禁用/启用Android的物理键盘?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有我开发使用连接到摩托罗拉Xoom某些输入一个USB HID设备的应用程序。然而,大多数的时候我仍然想使用屏幕键盘。

I have an application that I'm developing that uses a USB HID device connected to a Motorola Xoom for some input. However, the majority of the time I still want to use the on-screen keyboard.

有没有一种方法来禁用/启用Android 3.0以上版本使用硬件键盘?我想表现得像它会应用,也有没有连接的键盘。

Is there a way to disable/enable the use of hardware keyboard in Android 3.0+? I'd like the application to behave like it would, had there not been a keyboard connected.

推荐答案

以及你能想到的一个解决方案是...

well one solution you can think of is ..

@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
    return true;
}
@Override
public boolean onKeyLongPress(int keyCode, KeyEvent event) {
    return true;
}
@Override
public boolean onKeyUp(int keyCode, KeyEvent event) {
    return true;
}

这将避免键盘键preSS过程中的任何行动。但没有办法,你可以禁用Android键盘,因为它会使用一些本地方法。

this will avoid any actions during keyboard key press. but there is no way you can disable android keyboard since it will use some native methods.

这篇关于如何以编程方式禁用/启用Android的物理键盘?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆