views:

603

answers:

3

How can you hide an item in a ListView or at least set its height to zero?

I have tried setting the visibility of the View to GONE but it still maintains the item's space (height).

+1  A: 

I did some tinkering with a drag and drop list from here. When an item is popped out of the list to be moved around the cell space it occupied has it's height set to 1px (see line 238) so it appears "gone". I couldn't find a way to handle this better as setting height to 0 fails as does visibility GONE.

That said, If you really want to get rid of a row less temporarily, it might be a good idea to change the backing of the Adapter and call notifyDataSetChanged() on it.

jqpubliq
A: 

Any luck solving this problem? I am having an identical problem. Updating the data at the back end and calling notifyDataSetChanged() is an option, but one I want to avoid if at all possible - it will result in an expensive (and regular) processor hit in my application.

KingLeigh
A: 

add to your ListView object: android:dividerHeight="0px" android:divider="#FFFFFF"

Divider color doesn't matter only setting dividerHeight doesn't work

This does remove the divider though...

X-QlusioN