自定义层次阴影

drawlable 阴影
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
    <!--阴影-->
    <item android:gravity="bottom">
        <shape  >
            <!-- from top to bottom -->
            <size android:height="@dimen/margin_3"/>
            <padding android:bottom="3dp"/>
            <gradient
                android:angle="-90"
                android:endColor="@android:color/transparent"
                android:startColor="#ff000000" />
        </shape>
    </item>

    <!-- 底边 -->
    <item android:gravity="bottom">
        <shape android:shape="rectangle" >
            <padding android:bottom="@dimen/margin_1"/>
            <size android:height="@dimen/margin_1"/>
            <solid android:color="#bbb" />
        </shape>
    </item>
</layer-list>

layout 应用说明:
<View
    android:layout_width="match_parent"
    android:layout_height="3dp"
    android:alpha="0.3"
    android:background="@drawable/background_with_shadow_bottom"/>

猜你喜欢

转载自blog.csdn.net/xsg2357/article/details/77451335