Android, setting background color of button loses ripple effect

后端 未结 7 1114
北恋
北恋 2020-12-07 00:40

After adding color to an android button, it loses its ripple effect that makes the user feel like there is a responsive click. How do I fix this? I\'ve searched through many

7条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-07 00:54

    A very simple and straight forward way of doing this is to set ?attr/selectableItemBackground to android:foreground attribute of your button. Following xml is perfectly valid and works

提交回复
热议问题