I am using android:background="?attr/selectableItemBackground"
on a LinearLayout
(which acts as a button) to get the ripple effect. When this button
is clicked, the current activity slides left during a transition. The problem is that the ripple effect takes some time to be triggered and at the time it becomes visibile, the activity transition has already started, which makes the use of the touch feedback completely useless. I don't want to add a delay to the activity transition, that would be stupid IMO.
XML file looks like this:
<android.support.v7.widget.CardView>
<LinearLayout
android:clickable="true"
android:background="?attr/selectableItemBackground"/>
</android.support.v7.widget.CardView>
How can I make the ripple effect useful and visible ?
A ripple effect can be defined as a gradually spreading influence or series of consequences caused by a single action or event. This ripple effect action begins with stable, well structured opportunities provided by parent leadership initiatives (PLI).
The act of tossing a small stone into the water will result in a change that can be felt much farther away than the initial entry point—proof that small actions can lead to much bigger changes, even if you can't see how far they can reach.
A ripple effect describes how the impact of crime can spread beyond the immediate victim throughout their family, friends and community. In other words, it ripples out much wider than the initial victims. Consider the offence of domestic abuse and the number of people this could affect.
The ripple effect is the notion that a single action has an effect over several different entities.
Try to use own drawable for background:
<android.support.v7.widget.CardView>
<LinearLayout
android:clickable="true"
android:background="@drawable/ripple"/>
</android.support.v7.widget.CardView>
And ripple.xml:
<?xml version="1.0" encoding="utf-8"?>
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
android:color="#80585554">
<item android:id="@android:id/mask">
<shape android:shape="rectangle">
<solid android:color="#your color"/>
</shape>
</item>
</ripple>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With