Android Development notes-linear Layout

Source: Internet
Author: User

linearlayout is a linear layout control. Its child controls are arranged horizontally or vertically. sort all widgets or other containers, beyond the boundary, some controls will be missing or disappear. therefore, each row in a vertical list only has one widget or container , no matter how wide they are, A horizontal list will only have one row height (the height is the height of the top sub-control plus the border height ). linearlayout maintains the interval and alignment between the widgets or iner contained by linearlayout (relative to a control ). ).

Android: id -- specify the corresponding ID for the Control
Android: text -- specify the text displayed in the control. Note that strings should be used as much as possible here. string in the XML file
Android: grimace -- specifies the basic position of the control, such as center, right, and so on.
Android: textsize -- specify the font size of the Control
Android: background -- specify the background color used by the control, RGB naming method
Android: width -- specify the width of the Control
Android: height -- specify the height of the Control
Android: padding * -- specify the padding of the control, that is to say, the content in the Control
Android: sigleline -- if set to true, the control content is displayed in the same row

<? XML version = "1.0" encoding = "UTF-8"?> <Linearlayout xmlns: Android = "http://schemas.android.com/apk/res/android" Android: Orientation = "vertical" Android: layout_width = "fill_parent" Android: layout_height = "fill_parent"> <! -- Android: id -- specify the corresponding ID Android: text for the control -- specify the text displayed in the control. Note that strings should be used as much as possible here. the Android: grimace character string in the XML file specifies the basic position of the control, for example, center, right, and other places. Android: textsize: Specifies the font size of the Control. Android: background -- specifies the background color used by the control. The RGB naming method is Android: width -- specifies the width of the Control. Android: height -- specifies the height of the Control. Android: padding * -- specifies the padding of the control, that is to say, the content in the control is Android: sigleline -- if set to true, the control content is displayed in the same line --> <textviewandroid: Id = "@ + ID/firsttext" Android: TEXT = "first line" Android: gravity = "center_vertical" Android: textsize = "5pt" Android: Background = "# aa0000" Android: layout_width = "fill_parent" Android: layout_height = "wrap_content" Android: layout_weight = "1" Android: textcolor = "#000000" Android: singleline = "true"/> <textviewandroid: id = "@ + ID/secondtext" Android: text = "Row 2" Android: gravity = "center_vertical" Android: textsize = "15pt" Android: background = "# 0000aa" Android: layout_width = "fill_parent" Android: layout_height = "wrap_content" Android: layout_weight = "1"/> </linearlayout>

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.