The head, middle, and tail layouts involve adaptive layout content, summarizing two tips:
The first relative layout:
<?XML version= "1.0" encoding= "Utf-8"?><Relativelayoutxmlns:android= "Http://schemas.android.com/apk/res/android"Xmlns:tools= "Http://schemas.android.com/tools"Android:layout_width= "Fill_parent"Android:layout_height= "Fill_parent"Android:background= "#fff" > <!--use relative layout, head at the top, bottom at lowest, middle relative to both <!--head - <RelativelayoutAndroid:id= "@+id/rlhead"Android:layout_width= "Match_parent"Android:layout_height= "Wrap_content"Android:background= "@color/main_header_bg"android:gravity= "Center" > </Relativelayout> <!--Chubu - <LinearLayoutAndroid:layout_width= "Match_parent"Android:layout_height= "Wrap_content"Android:layout_above= "@+id/rlfoot"Android:layout_below= "@+id/rlhead"android:layout_centerinparent= "true"android:layout_centervertical= "true"Android:background= "@color/common_white"android:orientation= "vertical"Android:scrollbars= "None" > </LinearLayout> <!--Tail - <includeAndroid:id= "@+id/rlfoot"Layout= "@layout/widget_menu" /></Relativelayout>
The second use of gravity:
<?XML version= "1.0" encoding= "Utf-8"?><LinearLayoutxmlns:android= "Http://schemas.android.com/apk/res/android"Xmlns:tools= "Http://schemas.android.com/tools"Android:layout_width= "Fill_parent"Android:layout_height= "Fill_parent"Android:background= "#fff" > <!--Head - <RelativelayoutAndroid:layout_width= "Match_parent"Android:layout_height= "Wrap_content"Android:background= "@color/main_header_bg"android:gravity= "Center" > </Relativelayout> <!--using a linear layout, the head is at the top, the bottom is the lowest, and the middle uses the total weight of the remainder - <!--Chubu - <LinearLayoutAndroid:layout_width= "Match_parent"Android:layout_height= "Wrap_content"Android:background= "@color/common_white"android:orientation= "vertical"Android:scrollbars= "None"Android:layout_weight= "1"> </LinearLayout> <!--Tail - <includeLayout= "@layout/widget_menu" /></LinearLayout>
Android Development (18)--head, middle, bottom layout tips