Android 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/deliveryTop" />

    <stroke
        android:width="3dp"  //值越大,里面圆越小
        android:color="@color/deliveryBottom" />

    <size
        android:height="15dp"
        android:width="15dp" />

</shape>

  

画矩形,代码如下:

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

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

    <stroke
        android:width="2px"
        android:color="#ffffff" />

    <corners
        android:bottomLeftRadius="5dp"
        android:bottomRightRadius="5dp"
        android:topLeftRadius="5dp"
        android:topRightRadius="5dp" />

</shape>

  

原文地址:https://www.cnblogs.com/spring87/p/4693277.html