问题
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.
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.
回答1:
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;
}
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.
来源:https://stackoverflow.com/questions/7118810/how-do-i-programmatically-disable-enable-the-physical-keyboard-in-android