原型纯色的圆形Button

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" />

结果:

圆形纯色按钮
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容