set visibility android code example
Example: android studio visibility
//An ImageButton for example:
ImageButton btn = findViewById(R.id.viewID);
btn.setVisibility(View.INVISIBLE); // or...
btn.setVisibility(View.GONE); // or...
btn.setVisibility(View.VISIBLE);