I have implemented a ripple effect in android. Using the following code:-
<?xml version="1.0" encoding="utf-8"?>
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
android:color="#ff00ff00">
<item android:drawable="@android:color/black" />
</ripple>
And set it to the background of a textview
android:background="@drawable/ripple_over_drawable"
But the problem is that the ripple animation is very fast. I want to slow it down.
You can achieve the same effect by setting this as a background to the view:
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android"
android:enterFadeDuration="400"
android:exitFadeDuration="500">
<item
android:state_pressed="true">
<shape>
<solid android:color="@color/chrome_grey" />
</shape>
</item>
<item>
<shape>
<solid android:color="@android:color/white"/>
</shape>
</item>
</selector>
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