- //round_corner_bg.xml
- <?xml version="1.0" encoding="UTF-8"?>
- <shape xmlns:android="http://schemas.android.com/apk/res/android"
- android:shape="rectangle" >
- <!-- 填充的颜色 -->
- <solid android:color="#ff000000" />
- <!-- 设置矩形的四个角为弧形 -->
- <!-- android:radius 弧形的半径 -->
- <corners android:radius="7dip" />
- </shape>
或
<?
xml
version
=
"1.0"
encoding
=
"utf-8"
?>
<
shape
xmlns:android
=
"http://schemas.android.com/apk/res/android"
>
<
solid
android:color
=
"#FFFFFF"
/>
<
corners
android:topLeftRadius
=
"10dp"
android:topRightRadius
=
"10dp"
android:bottomRightRadius
=
"10dp"
android:bottomLeftRadius
=
"10dp"
/>
</
shape
>
layout中给button加上background属性
android:background="@drawable/round_corner_bg"
上述方法也适用于其他控件