Relativelayout of Android Layout

Source: Internet
Author: User

Today, I learned the relativelayout example on the official website. However, due to my limited level of English, I have seen a good Chinese version on the Internet to explain the usage of relativelayout attributes.

Go to http://blog.sina.com.cn/s/blog_55b1b0d50100n3d9.html. Thank you!


Android relativelayout attributes

// Relative to the given ID Control

Android: layout_above: place the bottom of the control on the control with the given ID;

Android: layout_below: place the bottom of the control under the control with the given ID;

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

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

 

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

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

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

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

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

// Relative to the parent component

Android: layout_alignparenttop if it is true, align the top of the control with the top of its parent control;

Android: layout_alignparentbottom: If this parameter is set to true, the bottom of the control is aligned with the bottom of its parent control;

Android: layout_alignparentleft: if it is true, align the left of the control with the left of its parent control;

Android: layout_alignparentright: if it is set to true, align the right of the control with the right of its parent control;

// Center

Android: layout_centerhorizontal if true, place the control horizontally in the center;

Android: layout_centervertical if true, place the control vertically in the center;

Android: layout_centerinparent if true, place the control in the center of the parent control;

// Specify the moving Pixel

Android: layout_margintop offset value;

Android: layout_marginbottom offset value;

Android: layout_marginleft value of the left offset;

Android: value of the right offset of layout_marginright;

 

Example:

Android: layout_below = "@ ID /***"

Android: layout_alignbaseline = "@ ID /***"

Android: layout_alignparenttop = true

Android: layout_marginleft = "10px"

 

Related Article

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.