//An ImageButton for example: ImageButton btn = findViewById(R.id.viewID); btn.setVisibility(View.INVISIBLE); // or... btn.setVisibility(View.GONE); // or... btn.setVisibility(View.VISIBLE);