You need to create one or more suitable files with key symbols as raw resource files, named for example. mykeyboard.kcm in your project.
Add the appropriate receiver to the manifest (AndroidManifest.xml) using KEYBOARD_LAYOUTS, pointing to an XML resource that lists all .kcm files as a keyboard layout. You do not enter any real Java or native code, just manifest and resource files.
https://github.com/tialaramex/BritishKeyboard
The link above is an example that I had to build before, which (basically) makes the layout in English (United Kingdom) available instead of the usual default US keyboard, for example. pressing SHIFT and 2 gives you a double quote instead of the @ character. Hope this is simple enough if you know a little about Android projects.
The end result is that when you connect a USB or Bluetooth keyboard, the prompt for setting the keyboard layout lists any additional keyboard layouts installed by applications, in which case one of them is marked as English (UK).
source share