CardView Layer-List

CardView Layer-List_第1张图片

How to make google card style, just card_bg.xml below:

<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">

    <item android:state_pressed="true"><layer-list>
            <item><shape android:dither="true" android:shape="rectangle">
                    <corners android:radius="2dp" />

                    <solid android:color="#ddd" />
                </shape></item>
            <item android:bottom="2dp"><shape android:dither="true" android:shape="rectangle">
                    <corners android:radius="2dp" />

                    <solid android:color="#eee" />

                    <padding android:bottom="8dp" android:left="8dp" android:right="8dp" android:top="8dp" />
                </shape></item>
        </layer-list></item>
    <item><layer-list>
            <item><shape android:dither="true" android:shape="rectangle">
                    <corners android:radius="2dp" />

                    <solid android:color="#ccc" />
                </shape></item>
            <item android:bottom="2dp"><shape android:dither="true" android:shape="rectangle">
                    <corners android:radius="2dp" />

                    <solid android:color="@android:color/white" />

                    <padding android:bottom="8dp" android:left="8dp" android:right="8dp" android:top="8dp" />
                </shape></item>
        </layer-list></item>

</selector>


你可能感兴趣的:(CardView Layer-List)