5

When using the selectableItemBackground attribute for "touch ripple effects", it seems that normal touches are too fast for the "touch ripple" to appear. I have to touch a bit longer and everything works as it should. Is it possible to force this effect some how, even on short touches?

Fhl
  • 1,079
  • 1
  • 12
  • 26

1 Answers1

0

I should suggest to you that create a custom ripple effect.

Selector for Pre API 21

<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:state_pressed="true">
        <shape android:shape="rectangle">
            <solid android:color="@color/colorAccent" />
        </shape>
    </item>
    <item>
        <shape android:shape="rectangle">
            <solid android:color="@android:color/transparent" />
        </shape>
    </item>
</selector>

Ripple Effect for API 21+ Devices

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

    <item
        android:id="@android:id/mask"
        android:drawable="@android:color/white" />
</ripple>

For More: Click Here