首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >安卓SearchView Filter ListView

安卓SearchView Filter ListView
EN

Stack Overflow用户
提问于 2012-12-26 17:13:02
回答 4查看 38.7K关注 0票数 20

我已经在我的SherlockAction栏中对我的SearchView实现了搜索过滤器。

当我输入m时,我想在下面只以M开头的列表视图中显示过滤后的结果,依此类推。但现在它显示随机结果。

代码语言:javascript
复制
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;
}
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/14038331

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档