Using Layer Lists In android To create a stunning UI.

34 sec read

Dear Developer

There are various Shape Drawables in Android.

  1. Shape Drawable
  2. Layer List
  3. Selector

 

For Shape Drawable we have a blog post : Link

 

For Selector Drawable we have a blog post : Link

 

For Layer Lists we are going to develop in this blog.

Expected output :

layout-2017-07-03-220503

<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
    <item>
        <shape android:shape="rectangle" >
            <solid android:color="#e60b0b" />
            <corners android:radius="10dp" />
        </shape>
    </item>
    <item android:left="2dp" android:right="2dp" android:top="2dp" android:bottom="2dp">
        <shape android:shape="rectangle" >
            <solid android:color="#000" />
            <corners android:radius="10dp" />
        </shape>
    </item>
 </layer-list>

 

Now use the layer list xml file as a background for your UI widget. and you can also build that stunning UI.

 

Thanks for reading.

 

Happy Coding.