Android layout details (ii)

Source: Internet
Author: User

LinearLayout

LinearLayout layout as a linear layout, arranging parts in a row or column form

The general new LinearLayout layout has a bit of properties

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/59/C5/wKiom1TgIiDwHJH3AACXZNkkqCE356.jpg "title=" 3.png " alt= "Wkiom1tgiidwhjh3aacxznkkqce356.jpg"/>

The Orientation property is used to specify the arrangement, and if you remove the sentence, the default is horizontal.

the width and height properties represent widths and heights, respectively. Available Constants (match_parent,fill_parent,wrap_content) adornments,

1) fill_parent

Setting the layout of a component to fill_parent will force the component to expand to fill as much space as possible within the layout unit. This is roughly the same as the DockStyle property of Windows controls. Setting a top layout or control for Fill_parent will force it to fill the entire screen.

2) wrap_content

Setting the size of a view to Wrap_content will force the view to expand to show the entire content. Take the TextView and ImageView controls as an example, set to Wrap_content to fully display the text and images inside them. Layout elements will change size based on content. Setting the size of a view to Wrap_content is roughly equivalent to setting the AutoSize property of Windows controls to true.

3) Match_parent
Android2.2 in Match_parent and fill_parent is a meaning. Two parameters meaning, match_parent more appropriate, so starting from 2.2 two words can be used. So if you consider the use of the lower version, you need to use fill_parent.


Absolutelayout

Absolutelayout can be used to specify the exact location of its child elements

Use android:layout_x and android:layout_y to specify for example:

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/59/C2/wKioL1TgQJWhpxmQAACr0R9RhR4304.jpg "title=" 4.png " alt= "Wkiol1tgqjwhpxmqaacr0r9rhr4304.jpg"/>

PS: After anduoid1.5, have been deprecated, so try to avoid using this layout


Tablelayout

Tablelayout organizes views in rows and columns, with a maximum width of each column

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/59/C6/wKiom1TgQgCCbALbAAHS0xA1kxo466.jpg "style=" float: none; "title=" 5.png "alt=" Wkiom1tgqgccbalbaahs0xa1kxo466.jpg "/>

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/59/C2/wKioL1TgQvvDeRXRAAE5zpQVO7o886.jpg "style=" float: none; "title=" 6.png "alt=" Wkiol1tgqvvderxraae5zpqvo7o886.jpg "/>

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/59/C6/wKiom1TgQgCRESatAAFGPtttSKo967.jpg "style=" float: none; "title=" 7.png "alt=" Wkiom1tgqgcresataafgptttsko967.jpg "/>


Relativelayout


The relativelayout is used to specify the relative position of the child elements, as shown in the following example:

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/59/C3/wKioL1TgVTCyG5HXAAKYXECHiPU852.jpg "style=" float: none; "title=" 8.png "alt=" Wkiol1tgvtcyg5hxaakyxechipu852.jpg "/>

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/59/C6/wKiom1TgVDXRHgujAADj7JZfbDc911.jpg "style=" float: none; "title=" 9.png "alt=" Wkiom1tgvdxrhgujaadj7jzfbdc911.jpg "/>

The above code forms the interface as shown:

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/59/C3/wKioL1TgVTCDfK2uAAFjg0oJT2w031.jpg "style=" float: none; "title=" 10.png "alt=" Wkiol1tgvtcdfk2uaafjg0ojt2w031.jpg "/>


In relativelayout, each child element has a property that aligns him to other elements:

Layout_alignparenttop

Layout_alignparentleft

Layout_alignleft

Layout_alignright

Layout_below

Layout_centerhorizontal

Each attribute is applied with the view ID


Framelayout

Framelayout is a placeholder that you can use to display a single view on the screen, and the view that you add to it is usually displayed in the upper-left corner


ScrollView

ScrollView is a featured Framelayout that lets users scroll to display a view that is larger than the screen. He can only contain a child view Alive view group, usually linearlayout.



This article is from the "Useless Uncle" blog, please be sure to keep this source http://aslonely.blog.51cto.com/6552465/1614577

Android layout details (ii)

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.