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....
Controls the initial visibility of the view. Must be one of the following constant values. Constant Value Description visible 0 Visible on screen; the default value. invisible 1 Not displayed, but taken into account during layout gone 2 Completely hidden, as if the view had not been added.
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.
try that setVisible(0) to visible true . and setVisible(4) to visible false. the text can be invisible but the button and datepicker no.
Android developers have added an extension androidx. core. view. ViewKt#isVisible to toggle visibility between View.
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.
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