我如何删除从列表视图过滤弹出文字? [英] How do I remove popup text from listview filter?

查看:113
本文介绍了我如何删除从列表视图过滤弹出文字?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的是一个ListView的文本过滤器,我想摆脱弹出视图,显示了过滤器的文本是什么。有什么办法消除这种看法?

I'm using a text filter on a ListView and I'd like to get rid of the popup view that shows what the filter text is. Is there any way to remove this view?

一些例如code:

    ArrayList<String> buildingNames = new ArrayList<String>();
    ListView list = (ListView)findViewById(R.id.list);

    list.setAdapter(new ArrayAdapter<String>(this, R.layout.menu_item, buildingNames));
    list.setTextFilterEnabled(true);

    list.setFilterText("test_filter");

当我设置了过滤器的文本,一个非常丑陋的看法弹出的ListView控件的底部,显示一下当前的过滤器的文本是:

When I set the filter text, a really ugly view pops up at the bottom of the ListView that shows what the current filter text is:

推荐答案

我找到了答案在这里: http://markmail.org/message/7uju6bmmaswag2lu

I found the answer here: http://markmail.org/message/7uju6bmmaswag2lu:

通过调用setTextFilterEnabled()你请求这个弹出。如果你   不想要它,禁用文本过滤。这是一个互动的功能,   的用户。它并不意味着被编程使用。如果你想   以编程方式筛选您的适配器,请致电用getFilter()在你的   直接适配器(如果您的适配器支持筛选。)

By calling setTextFilterEnabled() you do request this popup. If you don't want it, disable text filtering. This is an interactive feature for the user. It is not meant to be used programatically. If you want to programatically filter your adapter, call getFilter() on your adapter directly (if your adapter supports filtering.)

罗曼盖伊

所以,而不是使用setTextFilterEnabled你需要与过滤工作,直接像这样:

So rather than using setTextFilterEnabled you need to work with the filter directly like so:

CustomAdapter customAdapter = (customAdapter)myListView.getAdapter();
Filter filter = customAdapter .getFilter();
filter.filter("search string");

这篇关于我如何删除从列表视图过滤弹出文字?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆