Rabindra Khadka Rabindra Khadka -4 years ago 199
Android Question

How to add a ripple effect on a layout with rounded corners?

I want to set a ripple effect on layout with rounded corners. How can I do it?

Answer Source

Use Following code.

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

round_corner.xml

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
 <solid android:color="@color/BACKGROUND_COLOR" />
 <corners android:radius="6dp" />
</shape>
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download