1.画圆形的背景,在drawable目录下新建一个round.xml文件
<?xml version="1.0" encoding="UTF-8"?>
<shape
xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="oval"
android:useLevel="false" >
<padding
android:left="2dp"
android:top="1dp"
android:right="2dp"
android:bottom="1dp" />
<!--加圆形边框<stroke-->
<!--android:width="1dp"-->
<!--android:color="@android:color/white" />-->
<solid
android:color="@color/colorRound" />
<size android:width="80dp"
android:height="80dp" />
</shape>
Button添加背景色:
<?xml version="1.0" encoding="utf-8"?>
<Button xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="80dp"
android:layout_height="80dp"
android:adjustViewBounds="true"
android:background="@drawable/round_roll"
android:gravity="center"
android:text="A6009-23"
android:textColor="@color/colorWhite"
android:textSize="16sp" />
结果: