INVISIBLE vs GONE View in Android

Lot of time we have a requirement to hide the view either runtime or from xml. We have seen View.GONE and View.INVISIBLE but very few people knows difference between those two constants.

First we will see what android document says about it.


This view is invisible, but it still takes up space for layout purposes.


This view is invisible, and it doesn’t take any space for layout purposes.

As you can read that INVISIBLE will hide the view but will occupy its space, but GONE will hide the view as well as loose its space from the main view.

Below image will explain you what is the actual difference.


Invisible Vs Gone

As you can see when we have used android:visibility=”invisible” view is not visible but it still occupies space while in android:visibility=”gone” it will not occupy space of the view.

Disable future dates from DatePickerDialog in Android
Concat Two Strings In TextView Using DataBinding