如何文本过滤器在Android的ListView由SimpleCursorAdapter支持? [英] How to text filter an Android ListView backed by a SimpleCursorAdapter?
问题描述
我有一个由SimpleCursorAdapter支持一个ListView。
I have a ListView that is backed by a SimpleCursorAdapter.
我希望能够过滤列表中像你这样一个联系人列表,仅仅通过打字,我遇到了textFilterEnabled()
I'd like to be able to filter the list like you would a contacts list, just by typing, and I came across the textFilterEnabled()
但问题是,我看不出如何让它与SimpleCursorAdapter工作。
Problem is, I couldn't see how to get it to work with a SimpleCursorAdapter.
这甚至可能吗?
如果是的话,它怎么办?
Is this even possible?
If so, how is it done?
推荐答案
在 setTextFilterEnabled()
方法不会自动实现过滤,因为它不知道的什么的在光标
文本应进行筛选。
The setTextFilterEnabled()
method doesn't automatically implement filtering, as it doesn't know what in your Cursor
the text should be filtered against.
这<一href="http://groups.google.com/group/android-developers/browse_thread/thread/22b015b031a13bb2">android-developers螺纹有更多的细节。
其实,有一个很好的问题,提出有一天,这实际上是非常相似,你的问题;虽然它最初是问如何处理过滤时,有一个设备上没有物理键盘:
Actually, there was a good question asked the other day, which actually is very similar to your question; though it originally was asking how to handle filtering when there is no physical keyboard on a device:
- <一个href="http://stackoverflow.com/questions/1737009/answer-to-making-a-nice-looking-listview-filter-on-android">http://stackoverflow.com/questions/1737009/answer-to-making-a-nice-looking-listview-filter-on-android
这篇关于如何文本过滤器在Android的ListView由SimpleCursorAdapter支持?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!