4

Installed AndroidStudio 2.3, created a new virtual device having advanced setting hw.keyboard=true

Now I can use my PC keyboard to type text. Unfortunately I cannot find a way to change the keyboard layout from US-Style to match my german PC Keyboard. Especially typing in some symbols like e.g. "@" seems quite problematic (which would be <Alt-Gr> + <q> for a German layout).

Searching for answers all information I find is only about activating hw.keyboard (e.g. Android emulator doesn't take keyboard input - SDK tools rev 20 ) - which is not my problem.

My workaround: I installed F-Droid in the emulation and with that I installed Hacker's Keyboard. OK now I can use the soft-keyboard within the emulation but still would like to use my normal pc-keybaord.

Community
  • 1
  • 1
tverrbjelke
  • 1,234
  • 10
  • 15

2 Answers2

1

You can change Keyboard Layout in the Settings (Settings > System > Language) like on an actual Android Device when you run the Emulator, however this is not perfect, it seems not working for @,€, etc ...

dirkbo
  • 623
  • 9
  • 20
  • try to highlight the keywords and be clear with the format it will help to reach out your answer for others – Agilanbu Dec 14 '18 at 11:31
  • @Agilanbu: Wondering: *what* other keywords could it be? I feel your answer is still changing language only inside emulation, not allowing me to use my hardware USB PC Keyboard of my host, which is running the emulation. (currently I cannot verify it) – tverrbjelke Jan 07 '19 at 12:07
1

An alternative way is to create a keyboard char map file (*.kcm) and start the emulator via the command line.

See this documentation for details.

Here is a small extract from my current map file to map the key z to y and vice versa:

#keycode        display     number      base        caps        fn          caps_fn
Y               'Z'         'z'         'z'         'Z'         'z'         'Z'
Z               'y'         'y'         'y'         'Y'         'y'         'Y'

To use the charmap file (*.kcm) start the emulator with:

$ ./emulator -avd [AVD_DEVICE] -charmap /path/to/quertz.kcm

All available keycodes can be found in the source from the emulator.