How to set button click effect in Android?

后端 未结 14 2339
佛祖请我去吃肉
佛祖请我去吃肉 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 02:10

    To make your item consistent with the system look and feel try referencing the system attribute android:attr/selectableItemBackground in your desired view's background or foreground tag:

    
    

    Use both attributes to get desired effect before/after API level 23 respectively.

    https://stackoverflow.com/a/11513474/4683601

提交回复
热议问题