I\'ve got the following LinearLayout...
The documentation of Invisible says:
This view is invisible, but it still takes up space for layout purposes.
So setting the visibility of layout to invisible just hides the layout, but does not free the consumed space. If you want to do that you have to set the visibility to gone.
Gone does what you want:
This view is invisible, and it doesn't take any space for layout purposes.
See also: http://developer.android.com/reference/android/view/View.html#setVisibility(int)