3

I am implementing Android Material design Ripple effect by creating custom Ripple Drawable from xml.

Here id the code of 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 this same drawable creating the different effect(ripple) on RecyclerView and ListView.

Here are the screen shots of both views. List View Sample

Recycler View Sample

I have already wasted plenty of time finding the cause of difference but no luck.

Cœur
  • 32,421
  • 21
  • 173
  • 232
Gopal
  • 1,452
  • 1
  • 9
  • 28
  • Check My Answer. here is your answer [Click](http://stackoverflow.com/a/40008782/5967703) – Jigar Patel May 03 '17 at 10:30
  • Could you prepare a minimal working example of your issue and push it to github? Your case seems to be interesting, but it's hard to find the reason for the issue without the possibility to run the code. – Zielony May 04 '17 at 17:35
  • ok, I will do this, currently, I am in middle of something once I finish this I will upload my source on git. – Gopal May 06 '17 at 09:36

1 Answers1

0

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

Community
  • 1
  • 1
Jigar Patel
  • 1,394
  • 2
  • 10
  • 26
  • Thanks for your ans. but it is not working, still the same result and also I am trying to find the cause of this difference not only the solution. – Gopal May 03 '17 at 10:39