isCharacterKey 静态方法
- int keyCode
如果 keyCode 产生一个(美国键盘)字符,则返回 true。注意:目前这尚不包括非美国键盘上的字符(俄语、希伯来语等)。
实现
static bool isCharacterKey(int keyCode) {
if ((keyCode >= ZERO && keyCode <= NINE) ||
(keyCode >= NUM_ZERO && keyCode <= NUM_MULTIPLY) ||
(keyCode >= A && keyCode <= Z)) {
return true;
}
// Safari sends zero key code for non-latin characters.
if (Device.isWebKit && keyCode == 0) {
return true;
}
return (keyCode == SPACE ||
keyCode == QUESTION_MARK ||
keyCode == NUM_PLUS ||
keyCode == NUM_MINUS ||
keyCode == NUM_PERIOD ||
keyCode == NUM_DIVISION ||
keyCode == SEMICOLON ||
keyCode == FF_SEMICOLON ||
keyCode == DASH ||
keyCode == EQUALS ||
keyCode == FF_EQUALS ||
keyCode == COMMA ||
keyCode == PERIOD ||
keyCode == SLASH ||
keyCode == APOSTROPHE ||
keyCode == SINGLE_QUOTE ||
keyCode == OPEN_SQUARE_BRACKET ||
keyCode == BACKSLASH ||
keyCode == CLOSE_SQUARE_BRACKET);
}