android:visibility - Hide a Button, in XML

How to Hide a Button, in XML

android:visibility was added in API Level 1
Controls the initial visibility of the view.

1. Add a Button to your main.xml file.

2. In the main.xml file, add the code below.

  <Button
        ...
       android:visibility = "gone"
  />

3. All options:

visibile - Visible on screen; the default value.
invisible - Not displayed, but taken into account during layout (space is left for it).
gone - Completely hidden, as if the view had not been added.

4. Compile and run!

Related Articles:

Resources: