Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Control Android TextView visibility run time programmatically

In my Java Android application, in run time according to a condition I need to setvisible false in a TextView. How to do it run time programmatically?

like image 526
JibW Avatar asked Sep 29 '11 16:09

JibW


1 Answers

You're looking for the setVisibility method in View.

textView.setVisibility(View.GONE);
textView.setVisibility(View.INVISIBLE);

It doesn't take a boolean because you can set it to either Invisible or Gone. If it's Gone, it will not take up any "space" in the layout.

like image 99
Brandon O'Rourke Avatar answered Oct 28 '22 22:10

Brandon O'Rourke