如何使用SuggestionSpan?

时间:2017-12-04 13:43:22

标签: android spannablestring

我正在尝试向我的EditText添加一些自定义建议:

SuggestionSpan suggestionSpan = new SuggestionSpan(this, new String[]{"qweasd","mySuggestion", "suggestion2", "anything"}, FLAG_AUTO_CORRECTION);

EditText editView = (EditText)findViewById(R.id.edit_view);
Editable text = editView.getText();

text.setSpan(suggestionSpan,0, text.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE)
editView.setText(text);

这似乎不起作用,在输入/调整文本时,我无法在建议中看到任何内容。

此实施中是否缺少某些内容?

0 个答案:

没有答案