What is the difference between setVisibility(View.GONE) and setAlpha(0f)?
setVisibility(View.GONE) will not only hide your view but it will also recycle the space occupied by this view. However setAlpha(0f) is equivalent to setVisibility(View.INVISIBLE) that only hides the view and still takes the space in your layout.
setVisiblity(View.GONE)
makes the View invisible:
This view is invisible, and it doesn't take any space for layout purposes.
setAlpha(0)
just makes the View transparent, but it is still in the space and able to be interacted with.
Alpha docs: http://developer.android.com/reference/android/view/View.html#setAlpha(float)
Visibility docs: http://developer.android.com/reference/android/view/View.html#setVisibility(int)
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