Drawing two strokes for an Android ListView divider?

Is it possible to make two strokes (one after the other) for a ListView separator?

I tried the following drawable, but it only shows the first stroke:

<?xml version="1.0" encoding="utf-8"?>

<shape
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:shape="line">
    <stroke
            android:color="#eeeeee"
            />
    <size
            android:height="1px"
            />

    <stroke
            android:color="#c1c1c1"
            />
    <size
            android:height="1px"
            />
</shape>
+5
source share
2 answers

, . , -. , . . , - . , , . ( ):

<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:bottom="2dp">
        <shape android:shape="line">
            <stroke
                    android:color="#eeeeee"
                    android:width="2dp"
                    />
            <size
                    android:height="4dp"
                    />
        </shape>
    </item>
    <item android:top="2dp">
        <shape android:shape="line">
            <stroke
                    android:color="#c1c1c1"
                    android:width="2dp"
                    />
            <size
                    android:height="4dp"
                    />
        </shape>
    </item>
</layer-list>
+17

, 2 , 1px height , , .

litte (1x2) 2 , :

android:divider="@drawable/myTinyDivider"

, -.

+1

All Articles