I have a custom listView and the list item that i am using is a linear layout with couple of images and text. Now i want to make this list item a bit elevated just like the pic below

For the background of each list item, you can use an xml drawable to achieve this effect:
mydrawable.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="@color/border_shadow"/>
<corners android:radius="3dp" />
</shape>
</item>
<item
android:left="1dp"
android:right="1dp"
android:top="1dp"
android:bottom="3dp">
<shape android:shape="rectangle">
<solid android:color="@color/white"/>
<corners android:radius="3dp" />
</shape>
</item>
</layer-list>
To adjust the shadow sizes, tweak the left, right, etc. in the second item. Use it in your LinearLayout for each item as android:background="@drawable/mydrawable".
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