Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

3
  • How do you force set the height of the view? I tried setMinimumHeight(0); before hiding but doesn't seem to work. I've set it to GONE but the space of the cell is still left behind. Commented Dec 19, 2011 at 2:11
  • The height and width are layout parameters, so you have to set the LayoutParameters object for the view with the new width/height. See this SO answer: stackoverflow.com/a/2767142/59058. Basically, width, height and margins are properties that really apply to the view's container, not the view itself, so you use a parent-linked LayoutParameter object to define them. Commented Dec 21, 2011 at 16:40
  • I don't think that works for a header, I got null on a header that was attached and called getLayoutParams() for. Commented Apr 15, 2012 at 22:55