Search code examples
androidandroid-layout

what's the difference of setVisibility(View.INVISIBLE); setVisibility(0);


I met a strange issue, when i set a textview visibility as text.setVisibility(0); I cannot hide this textview. But after i update the code to text.setVisibility(View.INVISIBLE), the textview is hidden...

I have no idea, why this happened....


Solution

  • You got misconcept I think,

    0 stands for VISIBLE..You can check here Developer Doc

    0 is for VISIBLE
    4 is for INVISIBLE 
    8 is for GONE
    

    So nothing going wrong in your case,Its working properly as per you passed the parameter.