0

I want to achieve this shadow effect as a background drawable for my RelativeLayout:

enter image description here

I am trying to get the denoted effects in my layout. Here's the description:

A: Light Stroke around the RelativeLayout

B: Shadow under the layout and a slight shadow to the right and left of the layout

What I have so far:

<?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="#CABBBBBB"/>
            <corners android:radius="2dp" />
        </shape>
    </item>

    <item
        android:left="0dp"
        android:right="0dp"
        android:top="1dp"
        android:bottom="1dp">
        <shape android:shape="rectangle">
            <solid android:color="@android:color/white"/>
            <corners android:radius="2dp" />
        </shape>
    </item>
</layer-list>

What more should I add to get the displayed result?

Dinuka Jay
  • 4,233
  • 6
  • 53
  • 121

1 Answers1

0

You could use CardView also.

http://developer.android.com/training/material/lists-cards.html

Just add your own elevation and you are ready to go.

ʍѳђઽ૯ท
  • 15,369
  • 7
  • 47
  • 103