Android Layout 6 Big class

Source: Internet
Author: User

1: In our Android development, the common layout of the way there are 6 major categories

Linear layout LinearLayout

Relative Layout relativelayout

Table Layout Tablelayout

Single Frame layout framelayout

Absolute layout absolutelayout

Waterfall Flow Layout Recylerview (popular)-----See-------> Links http://blog.csdn.net/zchlww/article/details/51524951

2: Use Features

Most used: linear layout linearlayout, relative layout relativelayout, waterfall flow layout Recylerview (popular)

Note: In development, the layout and layout are usually nested with each other.

3: Analysis Layout

Linear layout LinearLayout

Arranges the child elements in a vertical or horizontal order ( default is horizontal if not specified ), and each child element is behind the previous element. This forms a single row of n columns,

Or a single row of n rows of layout, if you want n rows n columns, you can nest using LinearLayout. Look at the effect:

Layout/main_out.xml

<LinearLayoutxmlns: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" >    <TextViewAndroid:id= "@+id/firsttext"Android:layout_width= "Wrap_content"Android:layout_height= "Wrap_content"Android:background= "#FFFFFF"Android:text= "@string/first" />    <TextViewAndroid:id= "@+id/secondtext"Android:layout_width= "Wrap_content"Android:layout_height= "Wrap_content"Android:background= "#FFFF00"Android:text= "@string/second" />    <TextViewAndroid:id= "@+id/thirdtext"Android:layout_width= "Wrap_content"Android:layout_height= "Wrap_content"Android:background= "#FF00FF"Android:text= "@string/third" />    <TextViewAndroid:id= "@+id/fourthtext"Android:layout_width= "Wrap_content"Android:layout_height= "Wrap_content"Android:background= "#00FFFF"Android:text= "@string/fourth" /></LinearLayout>

The effect is as follows

There is no property specified by default horizontal arrangement , shown below, you can see the 4 label levels in sequence:

Now change the code a little bit, add the attribute android:orientation= "vertical" in the LinearLayout node and display the following:

To illustrate the layout method for n-row n columns, using nested structures ,

Layout/testlinear.xml file

<?XML version= "1.0" encoding= "Utf-8"?><LinearLayoutxmlns:android= "Http://schemas.android.com/apk/res/android"Android:layout_width= "Match_parent"Android:layout_height= "Match_parent"android:orientation= "vertical" >          <!--The upper part of the area -     <LinearLayoutAndroid:layout_weight= "1"Android:layout_width= "Fill_parent"Android:layout_height= "Wrap_content"Android:background= "#FFC90E"         >                      </LinearLayout>          <!--the lower part of the area -     <LinearLayoutAndroid:layout_weight= "1"Android:layout_width= "Match_parent"Android:layout_height= "Wrap_content"Android:background= "@color/green"android:orientation= "vertical"        >                                     <LinearLayoutAndroid:layout_width= "Match_parent"Android:layout_height= "Wrap_content"Android:layout_weight= "1"Android:background= "@color/red"android:orientation= "vertical" >                                 </LinearLayout>                                  <!--The bottom line is the linear layout, which is the final div. -                 <LinearLayoutandroid:baselinealigned= "false"Android:layout_width= "Match_parent"Android:layout_height= "Wrap_content"Android:layout_weight= "2.5"Android:background= "@color/aqua"android:orientation= "Horizontal"                    >                                         <!--here began the division of the left -                     <LinearLayoutAndroid:layout_width= "Wrap_content"Android:layout_height= "Match_parent"Android:layout_weight= "1"Android:background= "@color/coral"                       >                                                                                          </LinearLayout>                                         <LinearLayoutAndroid:layout_width= "Wrap_content"Android:layout_height= "Match_parent"Android:layout_weight= "1.78"Android:background= "@color/burlywood" >                                             </LinearLayout>                                                                                                         <LinearLayoutAndroid:layout_width= "Wrap_content"Android:layout_weight= "1"Android:layout_height= "Match_parent"Android:background= "@color/darkorange"                       >                                                                                          </LinearLayout>                                                                                   </LinearLayout>                                           </LinearLayout></LinearLayout>

As follows

--------------------------------------------------------------------------------------------

The above is the characteristic of linear layout.

Android Layout 6 Big class

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: info-contact@alibabacloud.com 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.