If you look at the layout properties of the button, there is visibility, and if this value is GONE, it has the same effect as erasing If you give the INVISIBLE, you can't see the button, but it has the effect of maintaining the original space.
View b = findViewById(R.id.button);
b.setVisibility(View.GONE);
Do it like this or in xml
<Button ... android:visibility="gone"/>
You can do it like this.
© 2024 OneMinuteCode. All rights reserved.