Difference between setVisibility() and setAlpha()

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)