setting android button invisible but still having an onClick Listener attached

后端 未结 10 1607
情深已故
情深已故 2021-02-06 06:39

So currently I\'m putting an Easter egg inside my app and I want the Button to be invisible, but when clicked(Rick roll). So far I can make it work when I say:

10条回答
  •  长发绾君心
    2021-02-06 07:04

    You can create any view, such as LinearLayout, as clickable. Make a LinearLayout with the same dimensions as the button and set it's onClick listener to whatever handles the event. Since it inherently isn't visible, it should hold the same effect.

提交回复
热议问题