圆的样式属性

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
    <solid android:color="#f8f8f8" />  /*实心的颜色*/
    <corners android:radius="6dp"/>    /*圆角度数*/
    <stroke android:width="1dp" android:color="#d7d7d7" />  /*边框颜色与粗细*/
</shape>
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="oval"
    android:useLevel="false">
    <solid android:color="@color/VI"/>
    <size android:width="27dp"
          android:height="27dp"/>
</shape>

Shape实心圆

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="oval">
    <solid android:color="@color/colorRed" />
    <size
        android:width="5dp"
        android:height="5dp" />
</shape>
虚线

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="line">
    <stroke
        android:width="@dimen/mdp_05"
        android:color="@color/line_color"
        android:dashWidth="@dimen/mdp_5"
        android:dashGap="@dimen/mdp_5" />
</shape>
使用时 要加android:layerType="software"  4.0以上不加的话会是实线
<View
    android:layout_width="match_parent"
    android:layout_height="@dimen/mdp_1"
    android:background="@drawable/sign_dotted_line"
    android:layout_marginLeft="@dimen/mdp_12"
    android:layout_marginRight="@dimen/mdp_12"
    android:layerType="software"
    android:layout_marginBottom="@dimen/mdp_3"
    android:layout_marginTop="@dimen/mdp_8"/>

空心圆

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="oval"
    android:useLevel="false">
    <stroke
        android:width="@dimen/mdp_1"
        android:color="@color/colorYellow_F7A01F" />
    <size
        android:width="@dimen/mdp_10"
        android:height="@dimen/mdp_10" />
</shape>

圆角

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
    <corners android:radius="5dp" />
    <padding
        android:bottom="@dimen/mdp_5"
        android:left="@dimen/mdp_10"
        android:right="@dimen/mdp_10"
        android:top="@dimen/mdp_5" />
    <solid android:color="#FFFFFF" />

    <stroke
        android:width="0.5dp"
        android:color="@color/color_eb" />
</shape>
按钮切换
<selector xmlns:android="http://schemas.android.com/apk/res/android">

    <item android:drawable="@mipmap/tab_new_community_normal" android:state_checked="false" />
    <item android:drawable="@mipmap/tab_new_community_selected" android:state_checked="true" />

</selector>
底部横线

<selector xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:state_checked="true">
        <layer-list>

            <item android:width="40dp" android:gravity="center_horizontal" android:top="28dp">

                <shape android:shape="rectangle">
                    <solid android:color="@color/color_blue" />
                </shape>
            </item>
        </layer-list>
    </item>

    <item android:drawable="@color/color_back_gray" />
</selector>




猜你喜欢

转载自blog.csdn.net/li_yu_csdn/article/details/80253512
今日推荐