我希望我的 TextView
具有圆形边框,并希望该环填充红色。
card_text_border.xml
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:innerRadius="10dp"
android:thickness="15dp"
android:useLevel="false"
android:shape="ring" >
<solid
android:color="@color/PrimaryDarkColor"/>
<stroke
android:width="4px"
android:color="#000000" />
</shape>
这是我的 TextView
<TextView
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:text="0"
android:id="@+id/txtView_cart"
android:paddingRight="10dp"
android:background="@drawable/card_text_border"
android:layout_gravity="top|right"/>
原文由 arps 发布,翻译遵循 CC BY-SA 4.0 许可协议
使用以下代码:
White_circle_drawable.xml
TextView