Android, setting background color of button loses ripple effect

后端 未结 7 1045
北恋
北恋 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条回答
  • 2020-12-07 01:09

    There was no answer for MaterialButton, so i will put it here.

    For MaterialButton (com.google.android.material.button.MaterialButton), use 'backgroundTint' and 'rippleColor'.

    <com.google.android.material.button.MaterialButton
        android:id="@+id/button_sign_in"
        android:layout_width="0dp"
        android:layout_height="55dp"
        app:backgroundTint="@android:color/white"
        app:rippleColor="?attr/colorControlHighlight"
    

    ?attr/colorControlHighlight is the default ripple color, you can change this value.

    0 讨论(0)
提交回复
热议问题