我计划在 Android 上创建一个自定义软键盘,支持英语和越南语两种语言。我在互联网上搜索了在 Android 上创建自定义键盘的指南:https://developer.android.com/guide/topics/text/creating-input-method.html 。 但我仍然不知道如何创建越南语键盘。在越南语键盘中,我需要处理一些情况: - 有些键当我双击时,它会变成另一个键。示例:
A -> double press: Â
O -> double press: Ô
E -> double press: Ê
...
有些键当我组合在一起按下时,它就变成了新的键。示例:
按 A,然后快速按 W -> 变成 Ă。 按 O,然后快速按 W -> 变成Ơ。 按 H、O、T、S -> 变为 HÓT。 按 H、O、N、F -> 变为 HÒN。 按 H、O、T、J -> 变成 HỌT。 按 H、O、I、R -> 变成 HỎI。 按 N、G、A、X -> 变为 NGà...
如何为越南语键盘创建keyboard_layout.xml?在上述情况下,如何在 android java 代码中处理越南语键盘?
最佳答案
这是您使用 IME 可以做到的唯一方法。请参阅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"
/>
关于java - 创建支持越南语和英语的自定义键盘 android,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59551536/