【发布时间】:2015-08-12 11:30:43
【问题描述】:
我正在为 android 编写一个字典应用程序。我想在 edditext 键入时将搜索数据填充到列表视图。它可以搜索,但打字速度太慢了。请帮帮我。
txtKeyword.addTextChangedListener(new TextWatcher() {
public void afterTextChanged(Editable s) {}
public void beforeTextChanged(CharSequence s, int start, int count, int after) {}
public void onTextChanged(CharSequence s, int start, int before, int count) {
String st = txtKeyword.getText().toString().trim();
lvData = (ListView) findViewById(R.id.lvData);
ArrayList<String> list = search(st);
adapter = new VicnAdapter(getApplicationContext());
adapter.setListView(list);
lvData.setAdapter(adapter);
restartSearch(st);
}
});
【问题讨论】:
标签: android android-edittext onchange