Android Button设置圆角和边框

drawable右键新建Drawable resource file

设置圆角和边框

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="rectangle">
    <!--设置背景色-->
    <solid android:color="#ffffff"/>
    <!--设置圆角-->
    <corners android:radius="4dp"/>
    <!--设置边框线的宽度和颜色-->
    <stroke android:width="1dp" android:color="#FECB51" />
</shape>

Button中设置background属性为该xml文件

猜你喜欢

转载自blog.csdn.net/yh18668197127/article/details/84848018