Problem:
I have a, that ListView
' s using a custom adapter. I want to dynamically add/remove items from the ListView
. I ' ve tried everything inside the getView()
method in my view adapter. I ' ve tried doing on the setVisiblity(View.GONE)
view I ' m returning. And it in fact doesn ' t draw the view, but it still allocates space for the view and it ' s just a blank black space.
Is this even possible to set items in ListView
invisible?
Reply:
You need to call Setvisiblity (View.gone) on the returned View and all of the views inside it. If You is reusing the convert view passed in you need to remember to call Setvisiblity (view.visible) on all the views you Want visible.
If you had a lot of invisible views, need to set the divider height to 0 and add your own divider to the returned Views. Otherwise the ' invisible ' views would each has a visible divider and produce a noticeable gray line between visible views.
Conclusion:
1) Set the view control to not be seen.
2) The control settings inside the view are not visible.
3) in the XML layout file, set the ListView divider height to 0, using a custom separator bar.
4) Set the divider bar inside the view to not be visible.
5) The first line of the separator bar is not considered.
Making a view in a ListView invisible Android