原因:
1.没有用<stroke >标签
2.没有指定<storke>标签的
颜色 或者
宽度。
正确代码:
文件地址:res/drawable-hdpi/circle_shape.xml
<shape android:shape="oval">
<stroke android:width="2dp" android:color="#f832"/>
<size android:height="10dp" android:width="10dp" />
</shape>
(上面的代码为一个椭圆形,如果你的View是宽高相等,就是圆形了,如下代码)
布局文件:
<TextView
android:layout_width="150dp"
android:layout_height="150dp"
android:gravity="center"
android:background="@drawable/circle_shape"
android:text="@string/hello_world" />
拓展:
stroke:用笔画,也可以翻译成轮廓吧。可以画空心的。像Paint.Style.STROKE
solide:固体的,实体的。 也就是实心的。像Paint.Style.FILL