How do I make a button invisible just after click?

前端 未结 5 1849
无人及你
无人及你 2021-01-14 12:01

I would like to know how to make a button visible but when clicked I want it to be invisible so it won\'t be shown at all.

5条回答
  •  萌比男神i
    2021-01-14 12:02

    you can do like this way.

    yourbutton.setVisibility(Button.GONE);
    

    This will be remove your button from your layout so other control will be used that space.

    If you want to just hide and keep button size with another layout you can use

    yourbutton.setVisibility(Button.INVISIBLE);
    

提交回复
热议问题