-5 about layout.

Source: Internet
Author: User

Last lesson lecture about view.
Today talk about layout.
What is layout?
Layout mean is how assemble each view and setting view of attribute.
Assemble layout has two roads.
One road is XML, other a road is Java file.
Android provide 5 category layout.
In turn is linearlayout framelayout relativelayout absolutelayout tablelayout ..

Linearlayout and relativelayout are one of the most commonly used.

Below will lecture about how use linearlayout.
Just as its name implies. It will let each view according linear layout.
In XML it has very a great partition attribute. Next tell about a simple example.

Example:

<Linearlayout xmlns: 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"
Android: Orientation = "vertical">
<Textview
Android: text = "first textview"
Android: layout_width = "match_parent"
Android: layout_height = "match_parent"
/>
<Textview
Android: text = "second textview"
Android: layout_width = "match_parent"
Android: layout_height = "match_parent"
/>

</Linearlayout>

Explain the example: First it is a linear layout, in it put two textview, because orientation is vertical, In that way they location is vertical lay up. of cause if orientation is horizontal, there are two textview will be horizontal location.

 

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.