How to erase or hide buttons on Android

Asked 2 years ago, Updated 2 years ago, 86 views

I want to know how to hide or erase the button as the title says.

android button

2022-09-22 22:10

1 Answers

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.


2022-09-22 22:10

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.