While Navigate User from Alphabets Keyboard to Symbols Keyboard, Layout Alignment gets spoiled. By Default, Layout takes 5dp padding & User can't see the Last Column Keys.
Note: Images shown in below.
I handled Key Actions to Navigate User from Alphabets Keyboard to Symbol Keyboard in the onKey Method
override fun onKey(primaryCode: Int, keyCodes: IntArray?) {
when (primaryCode) {
KEYCODE_ALPHABETS -> {
keyboardView?.keyboard = Keyboard(this, R.xml.keyboard)
}
KEYCODE_SYMBOLS_1 -> {
keyboardView?.keyboard = Keyboard(this, R.xml.keyboard_symbols_1)
}
KEYCODE_SYMBOLS_2 -> {
keyboardView?.keyboard = Keyboard(this, R.xml.keyboard_symbols_2)
}
}
}
Pls Suggest is there any other way to change keyboard (or) what I've done wrong
What I faced is shown below. Alphabets Keyboard:
While Change Keyboard in KeyboardView using setMethod in Kotlin, It changes with some mild UI Error
Note:
Keyboard Layout draws every key based on the percentage not in dp. So declare your key width as %p not in dp
In Layout file
<Row
android:horizontalGap="@fraction/key_horizontal_ten_keys_gap"
android:keyWidth="@fraction/ten_keys_key_width"
android:rowEdgeFlags="top">
</Row>
In Resource file
<fraction name="ten_keys_key_width">8.8%p</fraction>