【发布时间】:2012-12-11 21:04:56
【问题描述】:
我已经在我的 SherlockAction Bar 中为我的 SearchView 实施了搜索过滤器。
当我键入 m 时,我想在下面的列表视图中显示过滤结果,该列表视图仅以 M 开头,依此类推。但现在它显示的是随机结果。
public boolean onQueryTextChange(String newText) {
Log.i("Nomad", "onQueryTextChange");
if (TextUtils.isEmpty(newText)) {
adapter.getFilter().filter("");
Log.i("Nomad", "onQueryTextChange Empty String");
placesListView.clearTextFilter();
} else {
Log.i("Nomad", "onQueryTextChange " + newText.toString());
adapter.getFilter().filter(newText.toString());
}
return true;
}
public boolean onQueryTextSubmit(String query) {
Log.i("Nomad", "onQueryTextSubmit");
return false;
}
public boolean onClose() {
Log.i("Nomad", "onClose");
return false;
}
【问题讨论】:
标签: android searchview