2017-02-01 78 views
0

是否有任何事件檢測到自動提示詞選擇(詞典)Android鍵盤。從鍵盤輸入的Android鍵盤事件

下面

是我使用的檢測

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) 
    { 
    } 
}; 

回答

0

罰你可能會使用這個

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); 
} 
+0

更多的參考代碼[點擊](http://stackoverflow.com/questions/ 29031402/how-to-include-suggestions-in-android-keyboard) –

+0

上面的代碼是添加單詞到字典,但我想知道事件,當我們點擊建議(字典),將文本放在單詞中查看 – karthik

+0

此鏈接可能會有所幫助[點擊](https://developer.android.com/guide/topics/sea rch/adding-custom-suggestions.html) –