使用include
标签复用布局
- 1.include
标签的作用
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity"
android:orientation="vertical"> <include layout="@layout/activity_clude_item"/>
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:text="这是中间的东西"/> </LinearLayout>
- 2.include
标签的用法
<include layout="@layout/activity_clude_item"/>
- 1