简体   繁体   English

无法使用CursorAdapter子类过滤ListView

[英]Cannot filter ListView with CursorAdapter subclass

I have a subclass of CursorAdapter and I would like to filter my listview. 我有一个CursorAdapter的子类,我想过滤我的列表视图。 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. 我知道可以使用此处所述的ArrayAdapter来实现,并且使用自定义CursorAdapter方式对我不起作用。 I would like to do this with a custom CursorAdapter . 我想使用自定义CursorAdapter做到这一点。 What should I override and can I have an example? 我应该覆盖什么?我可以举个例子吗?

You can use CursorAdapter.setFilterQueryProvider to filter the list. 您可以使用CursorAdapter.setFilterQueryProvider过滤列表。 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 . 我的博客上有一个示例-它是在AutoCompleteTextView的上下文中使用的,但对于ListView应该以相同的方式工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM