Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android : difference between invisible and gone?

What is the difference between invisible and gone for the View visibility status?

like image 568
Rob Avatar asked Jul 19 '12 08:07

Rob


People also ask

What is the difference between VIEW gone and view invisible?

GONE This view is invisible, and it doesn't take any space for layout purposes. View. INVISIBLE This view is invisible, but it still takes up space for layout purposes.

What is view gone in Android?

View. GONE makes the view invisible without the view taking up space in the layout. View.


2 Answers

INVISIBLE:

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

GONE:

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

like image 178
Iñigo Avatar answered Oct 20 '22 08:10

Iñigo


From Documentation you can say that

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

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


Lets clear the idea with some pictures.

Assume that you have three buttons, like below

enter image description here

Now if you set visibility of Button Two as invisible (View.INVISIBLE), then the output will be

enter image description here

And when you set visibility of Button Two as gone (View.GONE) then the output will be

enter image description here

Hope this will clear your doubts.

like image 44
Pankaj Kumar Avatar answered Oct 20 '22 09:10

Pankaj Kumar