tags:

views:

183

answers:

0

I'm trying to make a custom list divider. It has one horizontal line that's a subtle gradient, and a second horizontal white line immediately below it as a sort of "drop shadow".

I'm trying to use <layer-list> to accomplish what I want, but it's not working out the way I expect.

Here's the code:

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

    <item>
        <shape>
            <gradient
                android:startColor="#ccd0d3"
                android:centerColor="#b6babd"
                android:endColor="#ccd0d3"
                android:height="1px"
                android:angle="0" />
        </shape>
    </item>

    <item android:top="2px">        
        <shape
            android:color="@android:color/white"
            android:height="1px" />
    </item>


</layer-list>

If I use android:divider to assign this to a ListView and set the android:dividerHeight="2", I get a grey gradient that's two pixels high. The white line is nowhere to be seen.

If I set the white line's android:top="1px", I see a one pixel grey gradient and a one pixel black line below it.

Any ideas what I'm doing wrong?