سؤال

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

enter image description here

Thanks!

هل كانت مفيدة؟

المحلول

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>
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top