Reputation: 1
I'm planning to create a custom soft keyboard on android which support two languages English and Vietnamese. I searched in internet a guideline to create a custom keyboard on android here: https://developer.android.com/guide/topics/text/creating-input-method.html. But I still don't know how to create a Vietnamese keyboard. In Vietnamese keyboard, there are some cases I need to handle: - Some keys when I double press, it becomes another key. Example:
A -> double press: Â
O -> double press: Ô
E -> double press: Ê
...
Some keys when I combine to press together, it becomes new keys. Example:
Press A, then fast press W -> it becomes Ă. Press O, then fast press W -> it becomes Ơ. Press H, O, T, S -> it becomes HÓT. Press H, O, N, F -> it becomes HÒN. Press H, O, T, J -> it becomes HỌT. Press H, O, I, R -> it becomes HỎI. Press N, G, A, X -> it becomes NGÃ...
How can I create keyboard_layout.xml for Vietnamese keyboard? And how can I handle Vietnamese keyboard in android java code in cases above?
Upvotes: 0
Views: 1275
Reputation: 1420
Only way you can do with IME. See http://developer.android.com/guide/topics/text/creating-input-method.html.
<input-method xmlns:android="http://schemas.android.com/apk/res/android"
android:settingsActivity="com.android.inputmethod.latin.SettingsActivity"
android:isDefault="@bool/im_is_default">
<subtype android:icon="@drawable/ic_subtype_keyboard"
android:label="@string/subtype_en_US"
android:imeSubtypeLocale="en_US"
android:imeSubtypeMode="keyboard"
android:imeSubtypeExtraValue="TrySuppressingImeSwitcher,AsciiCapable,SupportTouchPositionCorrection"
/>
<subtype android:icon="@drawable/ic_subtype_keyboard"
android:label="@string/subtype_generic"
android:imeSubtypeLocale="vi"
android:imeSubtypeMode="keyboard"
android:imeSubtypeExtraValue="KeyboardLayoutSet=qwerty,AsciiCapable"
/>
Upvotes: 0