0

I want to customise a ripple effect.

I have this xml

<?xml version="1.0" encoding="utf-8"?>
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
    android:color="@android:color/holo_orange_light">

    <item>
        <color android:color="@color/colorPrimary" />
    </item>
</ripple>

The holo-orange color is displayed perfectly but I can't figure out how to change the color of the overlaying layer when the ripple effect is activated. Any ideas?

David Safrastyan
  • 725
  • 7
  • 18
  • so you want to change the color of ripple or background?? can you show what exactly you want? – himanshu1496 Jul 25 '16 at 06:35
  • The color of the ripple itself , the background displays normally but the ripple color seems to be fixed at white color with some transparency – David Safrastyan Jul 25 '16 at 06:39
  • but your question says "holo-orange color is displayed perfectly", and according to your xml code it should display the orange color perfectly. – himanshu1496 Jul 25 '16 at 06:42
  • Perhaps I misused some terminology here, when I long press on the element with the ripple effect, the background changes to orange color and the white transparent layer appears and starts animating, I would like to modify the color of that transparent layer, Is that possible? – David Safrastyan Jul 25 '16 at 06:43
  • i think the white color you are mentioning is basically part of ripple effect so i am not sure if you can change it. Although You can change the solid background and ripple color when it is pressed. – himanshu1496 Jul 25 '16 at 06:52

1 Answers1

3

Please refer below link and try using their ripple code .

https://developer.android.com/reference/android/graphics/drawable/RippleDrawable.html

Sandip Lawate
  • 456
  • 3
  • 11