Android实现圆角边框

来源:互联网 发布:org.apache.log4j pom 编辑:程序博客网 时间:2024/05/16 14:11


设置边框圆角可以在drawable-mdpi目录里定义一个corners_bg.xml

Java代码
<?xml version="1.0" encoding="utf-8"?><shape xmlns:android="http://schemas.android.com/apk/res/android">    <!--<solid android:color="#0C9142" />-->单纯实现圆角背景图片    //设置圆角大小    <corners android:radius="150dp" />    //设置边框宽度和颜色    <stroke        android:width="1dp"        android:color="#0C9142" />    //设置圆角的另外一种方式 没有使用    <!--<corners-->    <!--android:topLeftRadius="20dp"-->    <!--android:topRightRadius="20dp"-->    <!--android:bottomRightRadius="20dp"-->    <!--android:bottomLeftRadius="20dp" />--></shape>




运行结果:


0 0