如何隐藏列表项? [英] How to hide a list item?

查看:122
本文介绍了如何隐藏列表项?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的是 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.

这<一href="http://stackoverflow.com/questions/19705004/sorting-listview-in-android/19705061#19705061">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

这篇关于如何隐藏列表项?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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