What is the difference between invisible
and gone
for the View visibility status?
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.
View. GONE makes the view invisible without the view taking up space in the layout. View.
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.
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
Now if you set visibility of Button Two as invisible (View.INVISIBLE
), then the output will be
And when you set visibility of Button Two as gone (View.GONE
) then the output will be
Hope this will clear your doubts.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With