且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在Android的列表视图中隐藏项目

更新时间:2022-11-08 08:59:38

您可以编写自己的 ListAdapter 或子类化现有的其中之一.

You can either write your own ListAdapter or subclass one of the existing ones.

在您的 ListAdapter 中,您只需通过返回 getCount()getItem() 的修改值来过滤掉不想显示的项目code> 和 getItemId() 视情况而定.

In your ListAdapter, you would simply filter out the items you do not want displayed by returning modified values for getCount(), getItem() and getItemId() as appropriate.