Android Learning Note (7) Absolutelayout+framelayout+relativelayout Learning

Source: Internet
Author: User

11th lesson for Joshui teacher , 12 lessons

One, Absolutelayout

Absolute layout, you can use android:layout_x or Y to specify the absolute coordinates, the layout of the android:orientation is not valid (only for linear layout) The disadvantage of this layout is lack of flexibility, difficult to maintain.


Two, framelayout
Frame layout, cascading, a bit like a stack, advanced in the bottom, will be the last cover.
Can be used android:layout_gravity= "" (Note that this is not android:gravity!!!) Parameters are:
Left|bottom Lower left
Right|bottom right Down
Left|top on top left
Right|top right up

Center, whatever.


Three, Relativelayout
Relative layout, the position of the control is determined by the relative distance between the controls, and cannot produce a cyclic dependency between the Relativelayout container itself and his child elements, for example, the height of the relativelayout cannot be set to WRAP_ Content when the height of the element is set to Alich_parent_bottom


Related attributes are: referenced here from http://www.douban.com/note/97496783/

First Class: Property value is True or False
Android:layout_centerhrizontal Horizontal Center
Android:layout_centervertical Vertical Center
Android:layout_centerinparent is completely centered relative to the parent element
Android:layout_alignparentbottom snaps to the bottom edge of the parent element
Android:layout_alignparentleft snaps to the left edge of the parent element
Android:layout_alignparentright snaps to the right edge of the parent element
Android:layout_alignparenttop snaps to the top edge of the parent element
android:layout_alignwithparentifmissing if the corresponding sibling element cannot be found, then the parent element is the reference.
Second class: The attribute value must be the reference name of the id "@id/id-name"
Android:layout_below at the bottom of an element
Android:layout_above at the top of an element
Android:layout_toleftof on the left side of an element
Android:layout_torightof on the right side of an element
Android:layout_aligntop aligns the top edge of this element with the top edge of an element
Android:layout_alignleft aligns the left edge of this element with the left edge of an element
Android:layout_alignbottom aligns the bottom edge of this element with the bottom edge of an element
Android:layout_alignright aligns the right edge of this element with the right edge of an element
Class III: Attribute values are specific pixel values, such as 30DIP/DP,40PX,50SP
Android:layout_marginbottom distance from the bottom edge of an element
Android:layout_marginleft distance from the left edge of an element
Android:layout_marginright distance from the right edge of an element
Android:layout_margintop distance from the top edge of an element
Android:padding the interval between a control and a container
Android:paddingtop


Good things to see often:

Android layout properties, Tag Properties Summary

Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

Android Learning Note (7) Absolutelayout+framelayout+relativelayout Learning

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.