如何隐藏列表项?列表

由网友(半疯癫︶ε╰)分享简介:我使用的是 BaseAdapter 的观点持有者模式。I am using a BaseAdapter with the view holder pattern.和我想隐藏的列表视图设置一定的项目:And I want to hide a certain items from the Listview setti...

我使用的是 BaseAdapter 的观点持有者模式。

I am using a BaseAdapter with the view holder pattern.

和我想隐藏的列表视图设置一定的项目:

And I want to hide a certain items from the Listview setting :

convertView.setVisibility(View.GONE);

什么都不做。

推荐答案

从适配器的列表中删除的项目,并重新加载adaper,如果需要再次显示该项目再考虑使用其他列表中。

Remove its item from adapter's list and reload adaper, if you need to show that item again then consider using another list.

这Answer做你需要操作的列表,它排序​​,你可以适应它删除项目

This Answer do what you need manipulating the list, it sorts, you can adapt it for removing items

修改

要实现撤消,则可能需要保存原始值的列表,一个堆栈来保存删除的项目指标和另一个列表从最初的名单,removed_indices产生,这将在适配器中使用

To implement undo, you may need a list that holds original values, a stack to hold removed item indices and another list to be generated from original list-removed_indices and that will be used in your adapter

阅读全文

相关推荐

最新文章