Reprint please indicate: reproduced in http://www.cnblogs.com/Liuyt-61/p/6602915.html
-----------------------------------------------------------------
> Merge UI layouts with merge
What it does: Merge UI layouts that reduce the nesting level of the UI layout
Scene (1): The layout root node is framelayout and does not need to set properties such as background or padding, which can be replaced by the merge.
Scene (2): When a layout is used as a sub-layout by another layout include, use merge as the top node of the layout, which is automatically ignored when the top node is introduced.
Common_progress.xml<?xml version="1.0"encoding="Utf-8"? ><merge xmlns:android="http://schemas.android.com/apk/res/android"Android:layout_width="match_parent"Android:layout_height="match_parent"android:orientation="Vertical"> <ProgressBar android:layout_width="wrap_content"Android:layout_height="wrap_content"android:layout_gravity="Center"/> <TextView Android:id="@+id/textview"Android:layout_width="wrap_content"Android:layout_height="wrap_content"android:layout_gravity="Center"Android:text="Please later"/></merge>-------------------------------------------------Main.xml<?xml version="1.0"encoding="Utf-8"? ><linearlayout xmlns:android="http://schemas.android.com/apk/res/android"Android:layout_width="match_parent"Android:layout_height="match_parent"android:orientation="Vertical"> <include layout="@layout/common_title"/> <framelayout android:layout_width="match_parent"Android:layout_height="wrap_content"> <TextView Android:id="@+id/textview"Android:layout_width="match_parent"Android:layout_height="wrap_content"Android:text="Body Content"android:textsize="16sp"/> <include layout="@layout/common_progress"/> </FrameLayout></LinearLayout>
[Android] Android Layout Optimization Merge