[英]How to track the keys pressed in soft keyboard in Android?
How can I track the keys pressed by the user in keyboard in android? 如何在Android的键盘中跟踪用户按下的键? Is this possible or I have to create a keyboard myself? 这可能吗,或者我必须自己创建一个键盘? What could be the possible way ? 可能的方法是什么?
Please check Creating An Input Method . 请选中创建输入法 。 This would help you in creating a custom Input Method. 这将帮助您创建自定义输入法。 You can check the Sample Application in your Android SDK directory. 您可以在Android SDK目录中检查示例应用程序。 Please follow as per this link . 请按照此链接进行操作 。
One way to liste for those is: 列出这些的一种方法是:
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_BACK) {
// Log the Key that was pressed or do whatever you need
// keyCode contains all the possible keyCode presses
}
else if(keyCode == KeyEvent.KEYCODE_1){
//You can insert catches for each particular keypress here
}
return super.onKeyDown(keyCode, event);
}
All the codes are here in this LINK , take a look at them. 所有代码都在此LINK中 ,看看它们。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.