之前写ring这个标签的时候一直不管用,直到今天看Android艺术开发与探索才发现这个标签是有用的,它有5个特殊属性,需要配置一下,一般只用配置3个,并且必须配合stroke标签一起使用否则可能无法达到预期效果。
举例画个红色圆环:
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"android:shape="ring"
android:innerRadius="20dp"//圆环的内半径
android:thickness="2dp"//圆环的厚度
android:useLevel="false">//一般都为false,书上也没具体解释这个属性
<stroke android:width="2dp" android:color="#ff0000"/>
</shape>