Question

Is it possible to achieve the following as a drawable (for a background) using a Layer-List ???

enter image description here

Thanks!

Was it helpful?

Solution

Try this xml :

<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >

    <item
        android:bottom="10dp"
        android:right="10dp">
        <shape
            xmlns:android="http://schemas.android.com/apk/res/android"
            android:shape="rectangle" >
            <solid android:color="#0000FF" />
        </shape>
    </item>
    <item
        android:right="10dp"
        android:top="10dp">
        <shape
            xmlns:android="http://schemas.android.com/apk/res/android"
            android:shape="rectangle" >
            <solid android:color="#FF0000" />
        </shape>
    </item>
    <item
        android:left="10dp"
        android:top="10dp">
        <shape
            xmlns:android="http://schemas.android.com/apk/res/android"
            android:shape="rectangle" >
            <solid android:color="#FFFF00" />
        </shape>
    </item>
    <item
        android:bottom="10dp"
        android:left="10dp">
        <shape
            xmlns:android="http://schemas.android.com/apk/res/android"
            android:shape="rectangle" >
            <solid android:color="#00FF00" />
        </shape>
    </item>
    <item
        android:bottom="10dp"
        android:left="10dp"
        android:right="10dp">
        <shape
            xmlns:android="http://schemas.android.com/apk/res/android"
            android:shape="rectangle" >
            <solid android:color="#0000FF" />
        </shape>
    </item>
    <item
        android:bottom="10dp"
        android:left="10dp"
        android:right="10dp"
        android:top="10dp">
        <shape
            xmlns:android="http://schemas.android.com/apk/res/android"
            android:shape="rectangle" >
            <solid android:color="#3f3f3f" />
        </shape>
    </item>

</layer-list>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top