I assume that you know how to get a link to the views you define, for example:
Button button = (Button)findViewById(R.id.emailbutton)
You will need to define an identifier for each view that you want to use in the code, just as you did with the email button:
android:id="@+id/emailbutton"
To set the visibility of a view, you call:
button.setVisibility(View.GONE);
You have the option to set the visibility to INVISIBLE and VISIBLE . Then you can play with visibility as you like. The difference between INVISIBLE and GONE is that GONE completely removes the view from the layout, and INVISIBLE "saves" the space that this view occupies.
You can see this in the API examples.
source share