试了许多方法,但发现,对 “null” 过滤后,ListView 便会显示所有内容。
代码详见下面:
// 用户输入字符时激发该方法 @Override public boolean onQueryTextChange(String newText) { // 如果newText是空的字符串的话 if (TextUtils.isEmpty(newText)) { // 过滤条件为null,显示所有内容 adapter.getFilter().filter(null); } else {
试了许多方法,但发现,对 “null” 过滤后,ListView 便会显示所有内容。
代码详见下面:
// 用户输入字符时激发该方法 @Override public boolean onQueryTextChange(String newText) { // 如果newText是空的字符串的话 if (TextUtils.isEmpty(newText)) { // 过滤条件为null,显示所有内容 adapter.getFilter().filter(null); } else {