How to use visibility on android studio?

Think I have 4 button on navbar. First button contains some data or items and other buttons also contains some data or items.

Note: All four buttons under a same xml file.

I want if I click first button it will show me first button data or items and same time it will hide others three buttons data or items. And I want to use same method for all buttons.

How can I do that please help me.


A button has different visibility, if you want to put your button non visible and non clickable programmatically the you should use:

Button button;
button.setVisibility(View.GONE);

If you don't want to see your button but you want an onClick than use:

Button button;
button.setVisibility(View.INVISIBLE);