我正在尝试在android中使用XML创建一个只有边框的圆圈:
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="oval" >
<stroke android:width="1dp"
android:color="#000000"/>
</shape>
我使用的代码发布在上面。但是,我得到一个实心磁盘而不是一个环。我想只使用 XML 而不是画布来获取输出。我究竟做错了什么?
谢谢。
编辑: 多亏了下面的答案,它才能工作。这是我的最终代码:
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:innerRadius="0dp"
android:shape="ring"
android:thicknessRatio="1.9"
android:useLevel="false" >
<solid android:color="@android:color/transparent" />
<size android:width="100dp"
android:height="100dp"/>
<stroke android:width="1dp"
android:color="#FFFFFF"/>
</shape>