在 new 一个 res/drawable/bg_corners.xml
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle" android:padding="10dp">
<solid android:color="#80000000" /> 线性布局内部为半透明
<stroke android:width="2px" android:color="#cbcbcb" /> 线条边框颜色
<corners android:topLeftRadius="25dip" android:topRightRadius="25dip"
android:bottomRightRadius="25dip" android:bottomLeftRadius="25dip" /> 各个边角的弯曲弧度
</shape>
在组件里的background属性设置:
如果线性布局当中使用它, 就可以将线性布局的边角变为圆角了,单个组件的话,就会单个组件是圆角:
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="4"
android:orientation="vertical"
android:visibility="visible"
android:background="@drawable/bg_corners"
>