How to simulate PC's Esc key on android

╄→гoц情女王★ 提交于 2019-12-11 02:38:23

问题


I'm writing an app that can play flash on android, but I can't simulate ESC key, since a lot of flash games need ESC key to return to the main menu, without this key the app I made will be useless. So who could tell me how to simulate this? Can I just send a keycode? but I don't know the keycode too...


回答1:


You want to have a look at the KeyEvent property. There is a constant value for KEYCODE_ESCAPE.

You can learn more about how to implement it here




回答2:


Most games use the BACK key for this.... See http://developer.android.com/sdk/android-2.0.html

Note that, while there is a key event ESCAPE (as Ezeh points out), that is only available at API level 11 (which is Android 3.0 and above - http://developer.android.com/guide/appendix/api-levels.html), which is not very widely available in devices yet.



来源:https://stackoverflow.com/questions/6530697/how-to-simulate-pcs-esc-key-on-android

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!