如何使用编辑框过滤列表视图 - Android
我正在制作法律术语词汇表,我希望能够通过在编辑框中键入内容来缩小列表中的结果范围,我尝试寻找解决方案,但没有一个对我有用。
I am making a Glossary of legal terms and I would like to be able to narrow the results in the list by typing in an edit box, I have tried finding a solution but none of them have worked for me.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在 Android 上,您不需要编辑框来实现这一点。并且不建议这样做。
相反,只需为您的自定义适配器实现 Filterable,一旦用户在查看列表时输入某些内容,它将进行过滤。屏幕键盘像往常一样出现按住菜单
这是一个教程,其中包含 实现可过滤
On Android you don't need a editbox to make that happen. And it's not advised to do so.
Instead just implement Filterable for your Custom Adaptor, and once the user will type in something while views the list it will filter. The onscreen keyboard as usual comes up with holding Menu
Here is a tutorial that has code to implement Filterable