xml中设置圆角矩形框

设置圆角的矩形框可以在drawable中新建个xml文件:

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" >

 <stroke
        android:width="1px"
        android:color="#000000" >
    </stroke>

    <corners android:radius="2dp" />

    <solid android:color="#ffffff" />

</shape>

stroke:矩形框线条颜色宽度

corners:圆角,android:radius="2dp"表示圆角弧度

solid:填充色


使用时只需要在xml中

android:background="@drawable/graybox_bg"即可

猜你喜欢

转载自blog.csdn.net/wb1211/article/details/54018980