Here is the example!!
ripple_for_white.xml
<?xml version="1.0" encoding="utf-8"?>
<!-- in drawable folder-->
<ripple
xmlns:android="http://schemas.android.com/apk/res/android"
android:color="?android:colorControlHighlight">
<item android:id="@android:id/mask">
<shape android:shape="rectangle">
<solid android:color="@color/gray" />
</shape>
</item>
<item>
<shape android:shape="rectangle">
<!-- put your background color here-->
<solid android:color="@color/white" />
</shape>
</item>
</ripple>
Create file in the drawable and the apply to your layout like this.
android:background="@drawable/ripple_for_white"
The best and simplest method would be to make use of **card_background** drawable in your layout. This also follows Google's material design guidelines. Just include this in you LinearLayout:
android:background="@drawable/card_background"
Add this to your drawable directory and name it **card_background.xml**:
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape android:shape="rectangle">
<solid android:color="#BDBDBD"/>
<corners android:radius="5dp"/>
</shape>
</item>
<item
android:left="0dp"
android:right="0dp"
android:top="0dp"
android:bottom="2dp">
<shape android:shape="rectangle">
<solid android:color="#ffffff"/>
<corners android:radius="5dp"/>
</shape>
</item>
</layer-list>