不能用的CursorAdapter子类ListView控件过滤 [英] Cannot filter ListView with CursorAdapter subclass

查看:181
本文介绍了不能用的CursorAdapter子类ListView控件过滤的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

的CursorAdapter 的子类,我想我的过滤列表视图。我知道,这可以用 ArrayAdapter 来实现如所述<一个href=\"http://stackoverflow.com/questions/1737009/how-to-make-a-nice-looking-listview-filter-on-android\">here并使用自定义这样的CursorAdapter 不为我工作。我想用一个自定义的的CursorAdapter 来做到这一点。我应该重写,我可以有一个例子吗?

I have a subclass of CursorAdapter and I would like to filter my listview. I know that this can be accomplished with an ArrayAdapter as stated here and that way using a custom CursorAdapter does not work for me. I would like to do this with a custom CursorAdapter. What should I override and can I have an example?

推荐答案

您可以使用<一个href=\"http://developer.android.com/reference/android/widget/CursorAdapter.html#setFilterQueryProvider%28android.widget.FilterQueryProvider%29\">CursorAdapter.setFilterQueryProvider过滤列表。我有<一个例子href=\"http://www.outofwhatbox.com/blog/2010/11/android-simpler-autocompletetextview-with-simplecursoradapter/\">my博客 - 这是在 AutoCompleteTextView ,但它应该工作的方式相同的ListView 。

You can use CursorAdapter.setFilterQueryProvider to filter the list. I have an example on my blog -- it's in the context of an AutoCompleteTextView, but it should work the same way for a ListView.

这篇关于不能用的CursorAdapter子类ListView控件过滤的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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