// 用户输入字符时激发该方法
 @Override
 public boolean onQueryTextChange(String newText) {
   if (TextUtils.isEmpty(newText)) {
     // 清楚ListView的过滤
     lv.clearTextFilter();
   } else {
     // 使用用户输入的内容对ListView的列表项进行过滤
     lv.setFilterText(newText);
   }
   return true;
 }
Пример #2
0
  @Override
  public boolean onQueryTextChange(String newText) {

    if (TextUtils.isEmpty(newText)) {

      lv.clearTextFilter();
    } else {
      lv.setFilterText(newText.toString());
    }

    return true;
  }