How can I disable Android Lollipop ripple's alpha value?

后端 未结 1 1413
渐次进展
渐次进展 2021-02-07 07:41

I have a ripple working with a custom color. However, the color is never fully opaque. According to the answers from What should be the color of the Ripple, colorPrimary or colo

相关标签:
1条回答
  • 2021-02-07 08:08

    You can simply put alpha value for bounded ripple.

    <ripple xmlns:android="http://schemas.android.com/apk/res/android"
            android:color="?android:attr/colorAccent">
        <item android:id="@android:id/mask">
            <color android:color="#42ffffff" />
        </item>
    </ripple>
    

    for unbounded ripple You can set opacity from color if you know your accent color

    <ripple xmlns:android="http://schemas.android.com/apk/res/android"
            android:color="@color/accent_26" />
    

    colors.xml

    <resources>
        ...
        <color name="accent">#ff33b5e5</color>
        <color name="accent_alpha26">#4233b5e5</color>
    </resources>
    
    0 讨论(0)
提交回复
热议问题