效果图如下

在这里插入图片描述

实现步骤

首先在drawablew文件中创建一个drawable resource file
在这里插入图片描述
跳转到下一个界面,进行图片中的操作
在这里插入图片描述

进行文件创建,然后进行配置

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<!--    设置按钮圆角按钮的步骤-->
<!--    1.设置圆角的半径-->
<!--    2.设置按钮的颜色-->
<!--    3.设置边框大粗细和颜色-->
    <corners android:radius="180dp"/>
    <solid android:color="@color/white"/>
    <stroke android:width="1dp"
        android:color="@color/btn_normal_gray"/>
</shape>

然后通过设置按钮背景,就可以实现圆角的效果

        <Button
            android:layout_width="60dp"
            android:layout_height="25dp"
           android:background="@drawable/btn_noraml"
            android:text="关注"
        android:textColor="@color/btn_normal_gray"/>

欢迎大家一起交流学习

Logo

华为开发者空间,是为全球开发者打造的专属开发空间,汇聚了华为优质开发资源及工具,致力于让每一位开发者拥有一台云主机,基于华为根生态开发、创新。

更多推荐