Android · 2016年8月30日 0

android Shape只显示指定边框用法

<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
    <!-- focused -->
    <item android:drawable="@drawable/orderboard_detail_tab_middle_selected" android:state_checked="true" />
    <item android:drawable="@drawable/orderboard_detail_tab_middle_selected" android:state_selected="true" />
    <!-- default -->
    <item >
        <layer-list xmlns:android="http://schemas.android.com/apk/res/android">
            <item android:left="-1dp" android:right="-1dp"  >
                <shape  android:shape="rectangle">
                    <solid android:color="@color/text_color_white" />
                    <stroke
                        android:width="1dp"
                        android:color="@color/text_color_blue" />
                    <padding
                        android:left="0dp"
                        android:right="0dp" />
                    <corners android:radius="0dp"/>
                </shape>
            </item>
        </layer-list>

    </item>
</selector>
上面执行的结果:只画上下线
QQ20160830-0@2x

Share this: