- Кастомизируем раскладку внешней клавиатуры на Android без root
- Теория
- Key Layout файлы
- Key Character Map файлы
- Дополнительные клавиатурные раскладки
- Практика
- Описание проекта
- Кастомизация файла раскладки
- Добавляем раскладку с другим языком
- Установка
- Заключение
- How to change the keyboard language on your Android phone or tablet using the Gboard app or Settings
- Check out the products mentioned in this article:
- Samsung Galaxy S10 (From $859.99 at Walmart)
- Google Pixel 4 (From $799.99 at Best Buy)
- How to add a language to your Gboard on Android
- How to change your keyboard language through the Gboard app spacebar
- How to swap your emoji keyboard for your language keyboard in the Gboard app
- How to Add Another Input Language on Android or Remove Keyboard Language
- Article Contents
- Add Another Input Language on Android 9 and 8
- How to Remove Keyboard Language on Android 8 and 9
- How to add another input language on Samsung Galaxy Devices Running Android 8
- How to add another input language on Android 7 Nougat, Android 6 Marshmallow, LineageOS 13
- Wrapping Up
- How to fix Bluetooth keyboard language settings
- Questions? Comments?
Кастомизируем раскладку внешней клавиатуры на Android без root
Мне нравится раскладка клавиатур на Mac: Cmd(Ctrl) под большим пальцем и возможность, без шаманства, прямо в настройках изменить поведение CapsLock. Такого же результата легко добиться в Linux с помощью setxkbmap в консоли или, например, gnome-tweak-tool в UI. Но что делать, если клавиатура подключается к Android?
В Android существует несколько способов кастомизировать внешнюю клавиатуру:
- Установка сторонней клавиатуры. Например, External Keyboard Helper.
- Правка/добавление kl или kcm файлов (требуется root). Как, например, в этом посте.
- Установка приложения, которое добавляет дополнительные клавиатурные раскладки.
Устанавливать стороннюю клавиатуру не хочется. Рутовать телефон — тоже. Остаётся третий вариант.
Теория
Вкратце пробежимся по основным понятиям со ссылками на документацию.
Key Layout файлы
Key layout (.kl) файлы отображают линуксовые коды клавиш (Linux Key Code), т.е. код, который производит конкретная клавиша на клавиатуре, на андродовские клавиши (Android Key), т.е. TAB, ENTER или просто буква F. Отображение по-умолчанию можно посмотреть здесь. Узнать, какая клавиша на клавиатуре какой код производит, можно, например, с помощью Gamepad Tester.
Key Character Map файлы
Key Character Map (.kcm) файлы позволяют задать поведение для сочетания клавиш, а также нужны для добавления раскладок, отличных от English(US).
Дополнительные клавиатурные раскладки
Начиная с версии 4.1 в Android стало возможным устанавливать вместе с приложением дополнительные раскладки клавиатуры. После установки раскладки доступны в Settings -> Language & input -> Physical keyboard . Минус этого подхода в том, что раскладки неизменяемы, и нет возможности кастомизировать их «на лету».
Практика
Вот что я хочу получить для моей клавиатуры:
- Esc вместо CapsLock.
- Поменять Ctrl/Win/Alt на Win/Alt/Ctrl слева и Alt/PrintScreen/Ctrl на Ctrl/Alt/Ctrl справа.
- Поменять переключение приложений с Alt+Tab на Ctrl+Tab.
- Скриншот на Ctrl+Shift+3.
- Переключение языков по Win+Space.
- Поддержка английской и русской раскладок.
Описание проекта
Т.к. мои вкусы весьма специфичны (Ты же хочешь Ctrl вместо CapsLock, мой дорогой любитель Vim?), а раскладки неизменяемы «на лету», я не предоставляю готовый apk-файл. Вместо этого создан custom-keyboard-layout — проект основа для кастомизации раскладки внешней клавиатуры на Android.
Клонируем проект к себе
Манифест приложения app/src/main/AndroidManifest.xml :
Приложение состоит из одного reciever . Забавно, что само наличие класса с заданным именем (в нашем случае InputDeviceReceiver ) не требуется — всё работает и без него, но имя мы задать обязаны. Этот reciever предоставляет список клавиатурных раскладок, хранящийся в app/src/main/res/xml/keyboard_layouts.xml :
В списке только одна раскладка — keyboard_layout_en_us .
Кастомизация файла раскладки
Файл раскладки app/src/main/res/raw/keyboard_layout_en_us.kcm состоит из одной строки, задающей тип раскладки:
Про этот тип ничего не сказано в документации, но опытным путём выяснено, что раскладка с таким типом по-умолчанию берёт значения из Generic.kcm. Т.е. мы уже получили английскую раскладку и всё что остаётся — это добавить наши правила.
Но сперва небольшое отступление про Key Layout файлы. Раскладки задаётся как kcm-файл, но для того чтобы поменять местами, например, Ctrl и Alt необходим kl-файл. Тут на помощь приходит ещё одна незадокументированная фича: с помощью команды map можно добавлять правила из kl-файла в kcm-файл.
Файл keyboard_layout_en_us.kcm с моими правилами:
К сожалению, у меня не получилось задать переключение языков по Win+Space — такое правило просто не срабатывало.
Добавляем раскладку с другим языком
Для добавления раскладки другого языка, отличного от English(US), нужно сперва составить kcm-файл с раскладкой этого языка, затем добавить к нему наши правила. Взять готовый файл для своего языка можно отсюда. Берём keyboard_layout_russian.kcm, кладём в app/src/main/res/raw/ и, соответственно, добавляем ещё одну раскладку в app/src/main/res/xml/keyboard_layouts.xml :
Не забываем добавить keyboard_layout_ru_label в app/src/main/res/values/strings.xml .
Теперь можно добавить наши правила, как в примере с английской раскладкой, но с небольшим изменением. В русской раскладке уже есть правило для ‘3’, поэтому нужно лишь изменить его, а не добавлять новое:
Состояние проекта после этой кастомизации можно посмотреть в ветке Vendor_17ef_Product_6048.
Установка
Собираем и устанавливаем наше приложение. Проще всего это сделать с помощью Android Studio следуя официальной документации.
Если всё сделано правильно, то в Settings -> Language & input -> Physical keyboard появятся наши раскладки, а в списке приложений — Custom Keyboard Layout .
Заключение
Кастомизация внешней клавиатуры без root возможна. Не все хотелки при этом достижимы: переключение языков по Win+Space так и не заработало, но это может быть проблемой прошивки.
Статья нарочно сделана краткой — все подробности можно найти по ссылкам.
Источник
How to change the keyboard language on your Android phone or tablet using the Gboard app or Settings
If you’re multilingual, and the standard English keyboard isn’t the only one you want to use when typing on your Android phone, good news — Gboard, Google’s keyboard app, allows you to easily add languages and switch between language keyboards as you type.
When you add a new keyboard language, Gboard allows you to choose how it looks, and whether you want it to be your primary or secondary language. Once it’s added, you can swap back and forth with just a couple of taps.
You can change your keyboard language settings from your Android device’s settings menu, your Gboard app settings, or directly on your Gboard using the space bar or emoji keyboard. However, before you can add or change any keyboard language on Android, you will have to first add or activate a new language on Gboard.
Because you’re technically changing the default language through a third-party app, switching or adding languages to your keyboard does nothing to affect your phone’s general language settings. That makes this method perfect for new language learners.
Here’s how to change the keyboard language on Android.
Check out the products mentioned in this article:
Samsung Galaxy S10 (From $859.99 at Walmart)
Google Pixel 4 (From $799.99 at Best Buy)
How to add a language to your Gboard on Android
1. Open Settings on your Android.
2. From the settings menu, select «System.»
3. Under System tap «Languages & input.»
4. In the «Languages & input» menu choose «Virtual keyboard.»
5. In the Virtual keyboard menu tap «Gboard.»
6. Tap «Languages.»
7. At the bottom of the Languages menu tap the «Add Keyboard» option to activate a new language keyboard.
8. Choose the language you wish to add.
9. Select the keyboard display you would like before adjusting other language settings and tapping «Done.»
How to change your keyboard language through the Gboard app spacebar
1. Open an app that requires your keyboard.
2. Press and hold on the spacebar and wait for the «Change Langage» window to appear.
3. Select the language keyboard you want to use from the pop-up menu that appears.
How to swap your emoji keyboard for your language keyboard in the Gboard app
1. On your keyboard, press and hold down on the comma in the lower-left corner.
2. Tap the Settings «gear» icon that appears directly above.
3. From the «Gboard Settings» menu, select «Preferences.»
4. In the «Preferences» menu, toggle «Show language switch key» to the on position.
5. If the «Show language switch» key is greyed out, it’s because you have the emoji switch key activated. Toggle that one off in order to turn the language switch feature.
Источник
How to Add Another Input Language on Android or Remove Keyboard Language
When you initialize your phone during the first startup you select the system language (locale for UI). Android 8 and 7 automatically set it as your input language as well. For English-speaking countries it is usually enough to use default settings and have the single input language. But you might also need to have several input methods.
For instance, you might want to communicate with your friends using German while you prefer using English for your work. Here is how to turn off the default settings and manually add another input language (or even several) to your current keyboard on Android 9, 8 and 7. The guide works for Android 6 Marshmallow as well.
Article Contents
Today we will show you instructions for:
Add Another Input Language on Android 9 and 8
Screenshots taken on Google Pixel running Oreo 8.0.
On Android 9 things are pretty much equal, so it’s rather useless to show screenshots.
- Open “Settings”:
- Scroll down and select “System”:
- Tap “Languages & input”:
- Select “Virtual keyboard”:
- Select your active keyboard. In my case it is “Gboard”:
- Tap “Add keyboard”:
- Select the language you need to add:
- Select layout, decide whether you want to enable multilingual typing and finally tap “Add”:
- Select which keyboard language you want to be primary by holding and dragging:
How to Remove Keyboard Language on Android 8 and 9
- Navigate to the language list using the steps above.
- Tap the rubbish can icon:
- Select the language you are going to remove.
- Tap the same icon once again:
How to add another input language on Samsung Galaxy Devices Running Android 8
- Go to Settings:
- Select General Management:
- Here tap Language and Input:
- Select On-screen keyboard:
- Now you should select your active keyboard. If you use default one select Samsung keyboard:
- Tap Languages and types:
- Tap on the Manage input languages button:
- Enable the language that you want to add to the keyboard. In our example we add German (Deutsch):
Done! Now you can type text in the language you added:
How to add another input language on Android 7 Nougat, Android 6 Marshmallow, LineageOS 13
- Open Settings :
- Scroll down to the System section.
- Find Language and input and tap it:
- Tap on your current keyboard name to open its settings. It can be Android keyboard or Samsung keyboard :
- Tap on Languages :
- Disable Use system language that is set by default (this setting makes you use a single input method for your keyboard – your system UI language):
- Scroll down the Active input methods list and enable languages that you need to use as your input methods. Perhaps, we would like to add German:
That’s it. Now you can switch input methods on your keyboard. The way how to do this depends on a particular keyboard. Here is how to change language on “Android keyboard”:
Wrapping Up
Of course, the Android OS is constantly developing and altering. That’s why you can face some minor changes on your particular phone. I mean that some settings may be called a little bit different or have new look. But the main steps meet the reality.
If you have questions, write them in the comments section. Let us know if everything was clear to understanding. Good luck!
Источник
How to fix Bluetooth keyboard language settings
Bluetooth keyboards are a brilliant way to write quickly and accurately on phones and tablets; they’re way better than tapping on glass for anything longer than a quick text. However, adding a Bluetooth keyboard can sometimes result in a few wrinkles, including one issue reported by our UK users.
The problem is this: In Android, a Bluetooth keyboard’s language setting is independent from the phone or tablet’s language setting. This means even if your device is set to UK English, your Bluetooth keyboard might be set to an American layout. That means the position of ” and @ are switched, amongst other changes.
Here’s how to set things right. You need to go into the Settings menu, then find the ‘Language & input’ option. (On recent versions of Android, you should see a ‘Select keyboard layout’ option in your notifications, which will take you to the same place.)
From here, find your Bluetooth keyboard listed under ‘Physical keyboard’ and press on its name. A menu will appear that lets you choose a keyboard layout. If you don’t see the correct option, choose ‘Set up keyboard layouts’. Then, find your desired language (e.g. English – UK) and tick the box. Now your Bluetooth keyboard should be set to its desired language.
If multiple languages are enabled, you may press Ctrl + Space on your Bluetooth keyboard to switch between them.
Questions? Comments?
I hope this answered your question. If you have any further questions or we can explain anything better, then let us know in the comments below!
Источник