Reputation: 11
How to implement following hover (Ripple) in android?
I have a linear layout and i want when user touched the layout all widgets in linear layout become lighter.
Upvotes: 0
Views: 242
Reputation: 175
Create a ripple drawable in res/drawable:
<?xml version="1.0" encoding="utf-8"?>
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:color="@color/ripple"
tools:targetApi="lollipop">
<item android:id="@android:id/mask">
<shape android:shape="rectangle">
<solid android:color="@color/ripple" />
<corners android:radius="@dimen/dp_6" />
</shape>
</item>
</ripple>
Set this drawable to the button foreground:
android:foreground = "@drawable/bg_btn_ripple_animation"
You can modify the ripple drawable as per your liking.
Upvotes: 1