0

I would like to create a custom keyboard for my app and it is possible to change the keyboard layout Fig.1 to Fig.2 without the user go to phone settings to change the keyboard.

enter image description here

Fig. 1

enter image description here

Fig. 2

Ludger
  • 362
  • 3
  • 16
  • You can do this if you make your keyboard be a custom view. Add a button to the view that when the user clicks it, the custom view will switch out the keyboard layout. – Suragch Apr 05 '18 at 08:23

2 Answers2

2

According to this article from Android Developer you can allow users to switch easily among multiple IME subtypes by providing a switching key, such as the globe-shaped language icon, as part of the keyboard. Doing so greatly improves the keyboard's usability, and can help avoid user frustration. To enable such switching, perform the following steps:

<input-method xmlns:android="http://schemas.android.com/apk/res/android"
                android:settingsActivity="com.example.softkeyboard.Settings"
                android:icon="@drawable/ime_icon"
                android:supportsSwitchingToNextInputMethod="true">
  1. Declare supportsSwitchingToNextInputMethod = "true" in the input method's XML resource files. Your declaration should look similar to the snippet that is above this
  2. Call the shouldOfferSwitchingToNextInputMethod() method.
  3. If the method returns true, display a switching key.
  4. When the user taps the switching key, call switchToNextInputMethod(), passing false to the second parameter. A value of false tells the system to treat all subtypes equally, regardless of what IME they belong to. Specifying true requires the system to cycle through subtypes in the current IME.

With this I think that the user could change the keyboard layout without going to settings of the phone

Example: https://android.googlesource.com/platform/development/+/master/samples/SoftKeyboard/

Jorge Casariego
  • 21,948
  • 6
  • 90
  • 97
  • the point is that I want my layout just like the fig. 2 the way you presented not possible I design my own layout. – Ludger Jun 11 '15 at 15:19
  • here you have an example to create a custom keyboard http://forum.xda-developers.com/showthread.php?t=2497237 I recommend you to read what @gabe-sechan had said about create a custom keyboard. http://stackoverflow.com/a/14284985/2091181 – Jorge Casariego Jun 11 '15 at 15:35
0

We created a keyboard specifically for our application, but you did need to 1) install the application, 2) go to Settings->Input Type ->keyboard and select the keyboard for use.

Here is a link to the keyboard on github:

https://github.com/techartist/MultiLanguageKeyboard

Not sure you can do what you asked. According to this link:

Switch android keyboard profile programmatically

...it is not possible.

Community
  • 1
  • 1
Kristy Welsh
  • 7,828
  • 12
  • 64
  • 106