First, create a new folder under Res drawable, create a new three XML file under drawable: Shape_corner_down.xml, Shape_corner_up.xml, and Shape_ Corner.xml, respectively, the following two corners are rounded borders, the top two corners are rounded borders, and four corners are rounded borders.
Shape_corner_down.xml:
1234567 |
<?xml version=
"1.0"
encoding=
"utf-8"
?>
<shape xmlns:android=
"http://schemas.android.com/apk/res/android"
>
<solid android:color=
"#0099CC" />
<corners android:bottomRightRadius=
"20dp"
android:bottomLeftRadius=
"20dp"
/>
<stroke android:width=
"1dp"
android:color=
"#000000"
/>
</shape>
|
Shape_corner_up.xml:
1234567 |
<?xml version=
"1.0"
encoding=
"utf-8"
?>
<shape xmlns:android=
"http://schemas.android.com/apk/res/android"
>
<solid android:color=
"#CCCC99"
/>
<corners android:topLeftRadius=
"20dp"
android:topRightRadius=
"20dp"
/>
<stroke android:width=
"1dp"
android:color=
"#000000"
/>
</shape>
|
Shape_corner.xml:
123456789 |
<?xml version=
"1.0"
encoding=
"utf-8"
?>
<shape xmlns:android=
"http://schemas.android.com/apk/res/android"
>
<solid android:color=
"#99CCFF"
/>
<corners android:topLeftRadius=
"20dp"
android:topRightRadius=
"20dp"
android:bottomRightRadius=
"20dp"
android:bottomLeftRadius=
"20dp"
/>
<stroke android:width=
"1dp" android:color=
"#000000"
/>
</shape>
|
<solid android:color> Sets the background color. Android:topleftradius, Android:toprightradius, Android:bottomleftradius, Android:bottomrightradius are the upper left corner, the upper right corner, the lower left corner, The radius value of the lower right corner, set the RADIUS value, the corresponding corner is rounded, the larger the radius value, the larger the fillet. <stroke> set boundary properties, such as the width, color, etc. of the boundary.
Place three linearlayout on Activity_main.xml, set android:background properties to Shape_corner_up.xml, Shape_corner_down.xml, and Shape_, respectively Corner.xml, the results of the operation are as follows:
Http://www.cnblogs.com/mstk/p/3539587.html
Android layout for rounded borders