Android Layout Properties

Source: Internet
Author: User

1. Linear Layout Properties

First, the LinearLayout property:
Android:background setting the background of the entire layout screen
Android:orientation= "Horizontal" sub-elements are arranged in a horizontal or vertical arrangement
android:gravity= The default alignment of the "bottom" child element in the layout
Android:padding to set the whitespace between child elements and layout edges
LinearLayout layout is characterized by: each child element is connected to each other, leaving no space in the middle.

Second, the LinearLayout property of the child element:
Android:layout_gravity Sets the default property given by the parent layout object Gravity property by setting its own object in the parent layout as a way to be updated
Android:layout_weight the remaining dimensions in the parent layout are populated by the weight value scale of each sibling element. Use with "Wrap_content".
android:layout_margin= "10DP" sets the space between the edge of its own object and the edge of the parent layout

2. Relative Layout properties

android:layout_margintop= "25dip"//Top distance
Android:gravity= "left"//Space layout location
android:layout_marginleft= "15dip//Distance left margin


Relative to the given ID control

Android:layout_above the bottom of the control to the control of the given ID;

Android:layout_below Place the bottom of the control under the control of the given ID;

Android:layout_toleftof aligns the right edge of the control with the left edge of the control for the given ID;

Android:layout_torightof aligns the left edge of the control with the right edge of the control for the given ID;



Android:layout_alignbaseline aligns the baseline of the control with the baseline of the given ID;

Android:layout_aligntop aligns the top edge of the control with the top edge of the given ID;

Android:layout_alignbottom aligns the bottom edge of the control with the bottom edge of the given ID;

Android:layout_alignleft aligns the left edge of the control with the left edge of the given ID;

Android:layout_alignright aligns the right edge of the control with the right edge of the given ID;

Relative to Parent component

Android:layout_alignparenttop If true, aligns the top of the control with the top of its parent control;

Android:layout_alignparentbottom If true, aligns the bottom of the control with the bottom of its parent control;

Android:layout_alignparentleft If true, aligns the left part of the control with the left part of its parent control;

Android:layout_alignparentright If true, aligns the right part of the control with the right side of its parent control;

Center

Android:layout_centerhorizontal If True, the control is placed horizontally centered;

Android:layout_centervertical If True, the control is placed vertically centered;

Android:layout_centerinparent If True, the control is placed in the center of the parent control;

Specify moving pixels

Relative to the parent control


The value of the offset on the android:layout_margintop;

Android:layout_marginbottom the value of the offset;

Android:layout_marginleft the value of the left offset;

Android:layout_marginright the value of the right offset;

Tablelayout property (also called global property): * Represents all Columns

Android:shrinkcolumns-------Set the columns that can be shrunk (the content is too much, then shrinks, expands to the second row, the control does not work when the tablelayout is not covered)

Android:stretchcolumns------Set extendable columns (filled with blanks)

Columns can have both Stretchcolumns and Shrinkcolumns properties

Android:collapsecolumns------Set the column to hide (index column starting from 0)

Internal Control Properties:

Android:layout_column-------The cell is displayed in the first few columns

Android:layout_span-------The cell occupies a number of columns, the default is 1

Android Layout Properties

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.