我正在尝试将TextWatcher与AutoCompleteTextView一起使用,但遇到了一些问题。我面临的问题是,当我开始输入文本时,如果数据输入只有一个字符长度,那么在AutoCompleteTextView中我得不到任何东西。
例如,如果我输入1,我应该得到一个包含1、10、101等的列表。然而,1从来没有出现在列表中。我该怎么做才能显示建议?
例如,如果我输入1,我应该得到一个包含1、10、101等的列表。然而,1从来没有出现在列表中。我该怎么做才能显示建议?
final AutocompleteCustomArrayAdapter adapter = new AutocompleteCustomArrayAdapter(context, R.layout.actv, new ArrayList<String>(), null);
textView.setAdapter(adapter);
textView.addTextChangedListener(new TextWatcher() {
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
adapter.notifyDataSetChanged();
}
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
}
@Override
public void afterTextChanged(Editable s) {
}
});