如何文本过滤由SimpleCursorAdapter支持的Android ListView? [英] How to text filter an Android ListView backed by a SimpleCursorAdapter?

查看:189
本文介绍了如何文本过滤由SimpleCursorAdapter支持的Android ListView?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个由SimpleCursorAdapter支持的ListView。



我想像一个联系人列表一样过滤列表,只需输入,我遇到了textFilterEnabled()



问题是,我看不到如何使用SimpleCursorAdapter。


解决方案

p> setTextFilterEnabled()方法不会自动实现过滤,因为它不知道光标中的



android-developers thread 有更多的细节。



其实,有一个很好的问题,天,其实和你的问题非常相似;虽然它最初是在设备上没有物理键盘时询问如何处理过滤:




I have a ListView that is backed by a SimpleCursorAdapter.

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()

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?

解决方案

The setTextFilterEnabled() method doesn't automatically implement filtering, as it doesn't know what in your Cursor the text should be filtered against.

This android-developers thread has more details.

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:

这篇关于如何文本过滤由SimpleCursorAdapter支持的Android ListView?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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