android 用shape oval属性画圆环变成黑圆形解决办法

来源:互联网 发布:征服者rd88升级软件 编辑:程序博客网 时间:2024/05/16 19:15

前言

使用Shape 的oval 属性画圆环图形在api15及api16 上会变成黑圆形

如下图所示


xml 如下

<?xml version="1.0" encoding="utf-8"?><shape xmlns:android="http://schemas.android.com/apk/res/android"     android:shape="oval">    <size android:width="235dp"        android:height="235dp" />    <stroke android:width="1dp"    android:color="@color/tr_white1" /></shape>


解决办法

经过研究 发现 需要填充背景色为透明即可

    <solid android:color="#00ffffff" />

如下图


xml 如下

<?xml version="1.0" encoding="utf-8"?><shape xmlns:android="http://schemas.android.com/apk/res/android"     android:shape="oval">    <size android:width="235dp"        android:height="235dp" />    <stroke android:width="1dp"    android:color="@color/tr_white1" />    <solid android:color="#00ffffff" /></shape>




0 0