How to set button click effect in Android?

后端 未结 14 2367
佛祖请我去吃肉
佛祖请我去吃肉 2020-11-28 01:29

In Android, when I set background image to Button, I can not see any effect on button.

I need some effect on button so user can recognize that button is clicked.

14条回答
  •  日久生厌
    2020-11-28 01:56

    just wanna add another easy way to do this: If your ImageButton remains its background and you don't set it to null, it will work like a normal button and will show the click animation while clicking exactly like other buttons.The way to hide the background while it is still there:

    
    

    The paddings won't let the background be visible and make the button act like other buttons.

提交回复
热议问题