开发者

Android special/hardware keys not generating Javascript events

I'm looking to build an app开发者_JS百科lication for Android using a Webkit view in Phonegap and have been assessing it for suitability, however I've hit one rather major snag.

I have tested this outside of Phonegap as well, and put up a test page here: http://tane.ifies.org/test.html

I have a Samsung Galaxy Tab with a physical keyboard. In the Phonegap application, it seems to be completely ignoring special keys, and specifically physical arrow keys on the keyboard.

I've written a small test binding the keyup event:

window.addEventListener('keyup', function(e) {
    alert(e.keyCode);
});

For all ASCII keys (a-z, 1-9 and keys like / ?, etc) I get a keycode back fine on both the virtual and physical keyboard, but again not for special keys, shift, ctrl or the arrow keys.

I also created a textarea - the arrow keys, etc work fine, but still do not seem to produce a key event in my window listener.

Is there a different event I need to listen to to capture these keys in Android?

I'm not too concerned about this being cross platform, the application is specific to my setup - although I may release it for Android in the future if there is a way to do this across the whole platform.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜