一.自定义View(该方法已经太过老旧)
<!--竖边框-->
<LinearLayout
android:layout_width="1px"
android:layout_height="match_parent">
<View
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/color_text_gamesize" />
</LinearLayout>
<!--横边框-->
<LinearLayout
<View
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/color_text_gamesize"
/>
android:layout_width="match_parent"
android:layout_height="1px">
</LinearLayout>
<!--竖线-->
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<View
android:layout_width="1px"
android:layout_height="60dp"
android:background="@color/color_line_border"
android:layout_marginRight="30dp" />
</LinearLayout>
二.自定义Layout
使用时以下两种层级关系灵活运用:
1.与要添加边框的布局(控件)平级
2.是要添加边框的布局(控件)的子布局
<RelativeLayout
android:background="@color/color_border"
android:layout_width="match_parent"
android:layout_height="2px"
android:layout_above="@+id/rl_content_top"></RelativeLayout>
<LinearLayout
android:background="@color/color_border"
android:layout_width="match_parent"
android:layout_height="2px"
android:layout_below="@id/sv_nav"></LinearLayout>