Hard keyboard character ing for Android-keycharactermap

Source: Internet
Author: User

Hard keyboard ing for Android-character ing keycharactermap

Basic preparation knowledge:

Http://source.android.com/porting/keymaps_keyboard_input.html

Http://blog.csdn.net/skdev/archive/2010/03/08/5355542.aspx keyboard ing process, has been very detailed.

Http://www.kandroid.org/android_pdk/keymaps_keyboard_input.html

How to output multiple characters with one click
If your keyboard is a full keyboard (including the ALT, shift, caps_lock function keys), you can use the default Android keyboard ing file Qwerty. KCM and Qwerty. KL. If you need to modify the key ing character, you can modify the KCM file. If you encounter an NC product designer, shoot his head and create an incomplete keyboard, you have to change the android framework layer. Unfortunately, this happened to me ~~~~ Only shift key bits are required, so shift switch back and forth is used to implement three input modes: lowercase letters, uppercase letters, and numbers, just like the Input Method software disk.

I. What is meta keys? ALT, shift, and caps_lock.

First, you need to understand the meaning of the KCM File
Column 1: keycode, which is issued by the kernel layer. The keycode is obtained through the *. KL keyboard ing file;
Base column: The status when meta_key is not activated, that is, the ing character when metastate = 0;
Caps column: Undoubtedly, it is the status when shift or caps_lock is activated. At this time, metastate = 1, The ing character;
FN column: indicates the characters mapped to metastate = 2 when ALT is activated;
Caps_fn column: The ing characters when both ALT, shift, and caps_lock are activated; at this time, metastate = 3;

Number Column: getnumber (mkeycode) returns the value represented by this key;

./Base/CORE/Java/Android/View/keyevent. Java: 871:
Public char getnumber (){
Return keycharactermap. Load (mdeviceid). getnumber (mkeycode );

Display column: Same as above, returned by getdisplay;

In this way, one-click output can correspond to multiple characters,

The QWERTY keyboard ing statement is implemented in the frameworks/base/CORE/Java/Android/text/method/qwertykeylistener. Java file.
Int I = event. getunicodechar (getmetastate (content); // getmetastate (content) corresponds

The getunicodechar (INT Meta) function is implemented in the file frameworks/base/CORE/Java/Android/View/keyevent. Java:
/Base/CORE/Java/Android/View/keycharactermap. Java: 139:
Unsigned short keycharactermap: Get (INT keycode, int Meta)
You also need to pay attention to the metakeykeylistener. Java file, which artificially and violently changes the metakey status or return value.

2. When you press the key, a candidate character with a phoneme is displayed.
Code: Public final int getrepeatcount () {return mrepeatcount ;}
'A', ---- → ă áâ ã å æ ą
'E', --- → é ê ė ę ě
'I', --- → guíí ~~~~
'O', --- → ó õ öŏ ő
'U', --- → ú úramu then
'A', --- → maid
'E', -- → é ê ë ě
'O', --- → ó ő
'U', -- → ú úrürü ų ū ŭ

Iii. Appendix: My Russian keyboard
[Type = QWERTY]

# Keycode display number base caps FN caps_fn

A 'A' 0x00 'A' A '0x0424 0x0444
B 'B' 0x00 'B' B '0x0418 0x0438
C 'C' 0x00 'C' C '0x0421 0x0441
D 'D' 0x00 'd 'D' 0x0412 0x0432
E 'E' 3 ''e' E' e '0x0423 0x0443
F 'F' 0x00 'F' F '0x0410 0x0430
G 'G' 0x00 'G' 0x041f 0x043f
H'h'0 x 00 'H' h'0 x 0420 0x0440
I'm 'I'm 8' I'm' I'm 0x0428 0x0448
J 'J '0x00 'J 'J '0x041e 0x043e
K'k' 0x00 'K' k'0x041b 0x043b
L 'l' 0x00 'l' l '0x0414 0x0434
M 'M' 0x00 'M' M '0x042c 0x044c
N 'n' '0x00 'n' 0x0422 0x0442
O 'o '9' o 'o '0x0429 0x0449
P 'P' '0' P' P '0x0417 0x0437
Q'q' '1' q'' q'0 x 0419 0x0439
R 'r''4''r''r'' 0x041a 0x043a
S's '0x00 's's '0x042b 0x044b
T 't'5' t't '0x0415 0x0435
U'u''7'' u''u'' 0x0413 0x0433
V 'V' 0x00 'V' v '0x041c 0x043c
W'w' '2' w'' w'0 x 0426 0x0446
X 'X' 0x00 'X' x '0x0427 0x0447
Y 'y' 6 ''y' y' 0x041d 0x043d
Z 'Z' 0x00 'Z' Z '0x042f 0x044f

# On PC keyboards
Comm', '';'' |'
Period '. '': '0x2026
At '@ '0'' @ '0' '0' 0 '0x2022
Slash '/''/''/''? ''? ''/'


Space 0x20 0x20 0x20 0x20 0xef01 0xef01 // Note: when Android receives the character value 0xef01, a special character selection box is displayed.

Enter 0xa 0xa 0xa 0xa 0xa 0xa 0xa

Tab 0x9 0x9 0x9 0x9 0x9 0x9
0 '0' '0' '0 '')'')'')'
1 '1' 1 '1 ''! ''! ''! '
2 '2' 2' 2 ''@''@''@'
3 '3' 3' 3 ''#''#''#'
4 '4''' 4''' 4''' $ ''' $'
5 '5' '5' % ''%'
6 '6' '6' '6' '^ ''^'
7'7''' 7''' 7 ''&''&''&'
8 '8' '8' '8 ''*''*''*'
9 '9' '9' '9 ''(''(''('

Grave ''''''''''~ '''''~ '
Minus '-''-''-''_''-''_'
Equals '= ''+'' = ''+'
Left_bracket '[''[''[''{''[''{'
Right_bracket '] ''}''] ''}'
Backslash '/' |'
Semicolon ';'';'';'':'';'':'
Apostrophe ''''''''''"'''''"'
Star '*''*''*''*''*''*'
Pound '#''#''#''#''#''#'
Plus '+ ''+'

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.