Reputation: 987
I would like to know which is the best way to show ripple effect in Android. It comes by default in buttons and all. But if we try to set the background color of the buttons, the effect will go off.
I saw some posts in stack overflow itself for creating this effect. But its an old post and Google would have added some new attributes to XML file to generate the effect.
Any help would be much appreciated. Thanks in advance.
Upvotes: 1
Views: 778
Reputation: 4134
Create this xml file in your drawable folder, replace the ripple color and name it "ripple.xml":
<ripple
xmlns:android="http://schemas.android.com/apk/res/android"
android:color="@color/your_ripple_color">
</ripple>
Now you can apply this as a background:
android:background="@drawable/ripple"
android:clickable="true"
Upvotes: 4