用于从字典键入的安卓键盘事件



是否有任何事件来检测自动建议单词选择(字典)安卓键盘。

以下是我用来检测的代码

    private final TextWatcher mTextWatcher = new TextWatcher() {
    @Override
    public void beforeTextChanged(CharSequence s, int start, int count, int after) {
    }
    @Override
    public void onTextChanged(CharSequence s, int start, int before, int count) {
    }
    @Override
    public void afterTextChanged(Editable s)
    {  
    }
};
很好,

你可以用这个

  if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
// On JellyBean & above, you can provide a shortcut and an explicit Locale
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);
}

最新更新