Android Relativelayout properties and Layout instances

Source: Internet
Author: User

Android:layout_above the bottom of the control to a control of the given ID relative to the given ID control; 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, and 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 control's baseline with the baseline of the given ID, and 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, and 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, or android:layout_alignparenttop, relative to the parent component, aligns the top of the control with the top of its parent control if true; android:layout_alignparent Bottom If true, aligns the bottom of the control with the bottom of its parent control, and Android:layout_alignparentleft if true, aligns the left part of the control with the left side of its parent control; Android:layout_ Alignparentright If true, aligns the right part of the control with the right side of its parent control, or center Android:layout_centerhorizontal if true to center the control horizontally; Android: Layout_centervertical If True, centers the control vertically; Android:layout_centerinparent if true, places the control in the center of the parent control;//Specifies to move the pixel Android: The value of the offset on the layout_margintop, the value of the Android:layout_marginbottom offset, the value of the android:layout_marginleft left offset; android:layouT_marginright the value of the right offset; Example:android:layout_below = "@id/***" android:layout_alignbaseline = "@id/***" android:layout_alignparenttop =  Trueandroid:layout_marginleft = "10px<?xmlversion= "1.0" encoding= "Utf-8 "?><linearlayoutxmlns:android= "Http://schemas.android.com/apk/res/android"Android:layout_width= "Fill_parent"Android:layout_height= "Fill_parent"android:orientation= "vertical">    <Relativelayoutandroid:id= "@+id/relativelayout01"Android:layout_width= "Wrap_content"Android:layout_height= "Wrap_content">      <!--the default of the first setting is the upper left of the parent container -      <Buttonandroid:id= "@+id/a"Android:text= "AAAA"Android:layout_width= "Wrap_content"Android:layout_height= "Wrap_content">      </Button>      <!--set B on the right side of a -      <Buttonandroid:id= "@+id/b"Android:text= "BBBB"Android:layout_width= "Wrap_content"Android:layout_height= "Wrap_content"Android:layout_torightof= "@+id/a"></Button>      <!--set C at the bottom of a, default to the left of the parent container -      <Buttonandroid:id= "@+id/c"Android:text= "CCCC"Android:layout_width= "Wrap_content"Android:layout_height= "Wrap_content"Android:layout_below= "@+id/a"></Button>      <!--Set D on the right side of C, under B, if not set to the right of C, then the deviation to the left of the position is the margin value, if not set Layout_below is placed in the position of the same horizontal position with B on the right side of C, set the left and the upper distance is 20d P -      <Buttonandroid:id= "@+id/d"Android:text= "DDDD"Android:layout_width= "Wrap_content"Android:layout_height= "Wrap_content"Android:layout_torightof= "@+id/c"Android:layout_below= "@+id/b"Android:layout_margintop= "20DP"Android:layout_marginleft= "20DP"></Button>   </Relativelayout> </LinearLayout>The effect is as follows:

Android Relativelayout properties and Layout instances

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.