Same Ripple drawable (effect) that looks different in ListView and RecyclerView

I am implementing a Distortion Effect for Android Material by creating a custom Ripple Drawable

from xml

.

Here is the id code ripple_effect_blue.xml

<ripple xmlns:android="http://schemas.android.com/apk/res/android"
    android:color="@color/colorPrimaryDark">
    <item android:id="@android:id/mask"
        android:drawable="@android:color/white" >
    </item>
</ripple>

      

But my problem is that you can do the same thing by creating different ripple effects on RecyclerView

and ListView

.

Here are screenshots of both views. List

Recycler

I've already spent a lot of time looking for the reason for the difference, but no luck.

+3


source to share


1 answer


Try this code

<?xml version="1.0" encoding="utf-8"?>
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:color="#f816a463"
    tools:targetApi="lollipop">
    <item android:id="@android:id/mask">
        <shape android:shape="rectangle">
            <solid android:color="#f816a463" />
        </shape>
    </item>
</ripple>

      



View Answer Here

0


source







All Articles