Tima Tima - 1 year ago 71
Android Question

How to hide an item in a listview in Android

I know, this question was asked before, but I haven't seen a working answer for it.

Is there any way to hide some items in a

without changing source data?

I tried to set visibility of the item view to gone, it won't be displayed anymore, but the place reserved for this item is still there.

I also set:


Without success.

Answer Source

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

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.