Android Development (18)--head, middle, bottom layout tips

Source: Internet
Author: User

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://"Xmlns:tools= "Http://"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://"Xmlns:tools= "Http://"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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.