Troj Troj - 1 year ago 79
Android Question

How can I remove a button or make it invisible in Android?

How can I remove a button in Android, or make it invisible?

Answer Source

Set button visibility to GONE (button will be completely "removed" -- the buttons space will be available for another widgets) or INVISIBLE (button will became "transparent" -- its space will not be available for another widgets):

View b = findViewById(;

or in xml:

<Button ... android:visibility="gone"/>
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download