我正在使用Latin IME创建自定义键盘。是否可以在拉丁键盘中添加拼写检查栏?
答案 0 :(得分:0)
你必须尝试这样
您需要将此权限添加到清单中:
<uses-permission android:name="android.permission.WRITE_USER_DICTIONARY"/>
在java代码中
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
UserDictionary.Words.addWord(this, "MadeUpWord", 10, "Mad", Locale.getDefault());
} else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.CUPCAKE) {
UserDictionary.Words.addWord(this, "MadeUpWord", 10, UserDictionary.Words.LOCALE_TYPE_CURRENT);
}
了解更多信息:https://developer.android.com/reference/android/provider/UserDictionary.Words.html