1,Corners
【1】Corners标签是用来字义圆角的,其中radius与其它四个并不能共同使用。
【2】android:radius:定义四个角的的圆角半径。
【3】其它四个是逐个字义每个角的圆角半径。
<corners //定义圆角
android:radius="dimension" //全部的圆角半径
android:topLeftRadius="dimension" //左上角的圆角半径
android:topRightRadius="dimension" //右上角的圆角半径
android:bottomLeftRadius="dimension" //左下角的圆角半径
android:bottomRightRadius="dimension" /> //右下角的圆角半径
2,Demo
【1】实现效果

【2】实现代码
-
在res/drawable文件夹下定义Shape文件
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" >
<corners android:radius="20dip"/>
<solid android:color="#ffff00"/>
</shape>
-
布局文件中的View 使用background 调用资源文件
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<TextView
android:layout_width="100dp"
android:layout_height="100dp"
android:layout_margin="50dip"
android:text="@string/hello_world"
android:background="@drawable/shape_radius"/>
</RelativeLayout>
Android XML资源文件相关:
https://blog.csdn.net/cricket_7/category_9540223.html