Five big layouts in Android

Source: Internet
Author: User

Android Five layout layout1,linearlayout linear layout: Set the arrangement of linear layout: horizontal arrangement horizontal, vertical arrangement verticaleg:android:orientation= "Horizontal" Controls the display area of the contents of the current control: eg:android:gravity= "right|center_vertical" controls the position of the current control in the parent element: eg:android:layout_gravity= "right" extra space allocation (weight): Additional total space (under <linearlayout/> node) android:layout_weightsumeg:android:layout_weightsum= "2" allocated for extra space: (In < LinearLayout/> Node) layout_weighteg:android:layout_weight= "1" Controls whether the layout is displayed: visible, not displayed, but occupies space invisible, hidden ( Do not occupy space) goneeg:android:visibility= "invisible" 2,relativelayout relative layout: android:layout_centervertical vertically centering Android in the parent layout: Layout_centerhorizontal Center horizontally in parent layout android:layout_centerinparent Center Eg:android:layout_centerhorizontal= "true" in parent layout Android:layout_alignparentleft If the parent layout is left-aligned android:layout_alignparenttop is aligned with the top of the parent layout android:layout_ Alignparentright whether the parent layout is right-aligned android:layout_alignparentbottom is aligned with the bottom of the parent layout eg:android:layout_alignparentright= "true" Android:layout_torightof on the right side of the specified control Android:layout_toleftof the left side of the specified control android:layout_above the top of the specified control Android:layout_ Below the bottom eg:an of the specified controldroid:layout_toleftof= "@id/btn_center" android:layout_alignbaseline is aligned horizontally with the specified control Android:layout_ AlignLeft to the left of the specified control android:layout_alignright to the right of the specified control Android:layout_aligntop aligns with the top of the specified control Android:layout_ AlignBottom aligns with the bottom of the specified control eg:android:layout_aligntop= "@id/btn_center" 3,tablelayout table layout: note: 1,<tablerow/> Cell row cell width is less than the default width when it does not work, its default is fill_parent, height can be customized size 2, column number starting from 0 row: 0,1,2,3 Android:shrinkcolumns Shrink Columns (set in <tablelayout/>, function throughout the table) Android:stretchcolumns La Pille (set in <tablelayout/>, function in the entire table) android:collapsecolumns hidden column (set in <tablelayout/>, function in the entire table) eg:android:shrinkcolumns= "0" when the width of the line is not enough, No. 0 Column Auto shrink narrowing eg:android:collapsecolumns= "0" hides the No. 0 column android:layout_column Specifies the control in the column where the row is located (set in <tablerow/>, which acts on the control specified in that row ANDROID:LAYOUT_SPAN Specifies the number of columns that the control occupies in the row (set in <tablerow/>, the control specified in the row), and the default value of 1 eg:android:layout_column= "2" specifies the control in the The 2nd column of the row (subscript 2) eg:android:layout_span= "2" specifies the number of columns that the control occupies in the row 24,absolutelayout absolute layout: android:layout_x Specifies the x-axis coordinates of the control in the parent layout eg : android:layout_x= "30DP" android:layout_y specifies the y-axis coordinates of the control in the parent layout Eg:anDroid:layout_y= "40DP" 5,framelayout frame layout: The newly added controls are overlaid on top of the previous control, i.e. each added control is displayed at the top 

Five big layouts in Android

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.