Android hide show button programmatically

Asked on August 13, 2015
How to hide and show button programmatically in android? 

Replied on August 13, 2015
Button, EditText, TextView, ListView etc are the classes in android and there is a method


In which we can pass


as required. See the samples.

1.  button.setVisibility(View.GONE)  will hide the button and space acquired by button
2.  button.setVisibility(View.INVISIBLE) will hide button only.
3.  button.setVisibility(View.VISIBLE) will make button visible.

Write Answer

©2024 | Privacy Policy | Contact Us