List view set a custom ripple selector

后端 未结 1 1312
我在风中等你
我在风中等你 2021-02-07 21:57

I\'m trying to use a list view control on Lollipop under the following conditions:

  1. The theme type is the default Theme.Material (dark theme).
  2. The list vie
相关标签:
1条回答
  • 2021-02-07 22:15

    You're using an unbounded ripple, e.g. a ripple with no content or mask layer, so the ripple is projecting onto the background of its parent ListView. You should set a mask layer to constrain the ripple bounds.

    res/drawable/my_list_selector.xml:

    <?xml version="1.0" encoding="utf-8"?>
    <ripple xmlns:android="http://schemas.android.com/apk/res/android"
        android:color="?attr/colorControlHighlight">
        <item android:id="@android:id/mask">
            <color android:color="@color/white" />
        </item>
    </ripple>
    
    0 讨论(0)
提交回复
热议问题