Layout:
1. Frame Layout framelayout:
Is the simplest of a layout object. All the display objects in him love you. will be fixed in the upper left corner of the screen, can not specify the location, but allow multiple display objects, but the latter will be directly covered on the previous display, will be the front of the components partially or completely blocked.
But we can use android:margintop to layout.
2. Linear layout LinearLayout:
Linear layout is one of the most commonly used classes in all layouts, and is also the parent class of Radiogroup, Tabwidget, Tablelayout, TableRow, zoomcontrols classes. LinearLayout can make its child elements line up vertically or horizontally (by default, in the vertical direction when not setting the direction).
3. Absolute layout absolutelayout
Absolute positioning absolutelayout, can also be called coordinate layout, you can directly specify the absolute position of sub-elements, this layout is simple and direct, intuitive, but because the mobile phone screen size difference is relatively large, the use of absolute positioning adaptability will be poorer. Use android:layout_x and android:layout_y to specify the horizontal and vertical coordinates of the child elements. In absolute positioning, if the child elements do not set layout_x and layout_y, their default value is 0, which means that the element will appear in the upper-left corner as if it were in framelayout.
4. Relative Layout relativelayout
Relative layout relativelayout allows child elements to specify their position relative to their parent or sibling elements, which is one of the most commonly used layouts in the actual layout. It is much more flexible, of course, many properties, the operation is also very difficult, the possibility of conflict between attributes is also large, the use of relative layout to do more testing.
Some of the important attributes that Relativelayout uses:
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,40px
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
For example: If the height of the ListView is Fill_parent,margintop or Marginbotoom is a specific value, the ListView
Does not fill the bottom space so that the ListView controls below cannot be displayed, and the ListView will display the content in the controls that are set, and the scrolling effect appears when too much content.
5. Table Layout Tablelayout
Table layout Tablelayout manages child elements as rows and columns, each of which is a TableRow layout object, or it can be a normal view object, TableRow each element is a column, and the total number is determined by the row with the highest number of columns.
collapsecolumns– settings Hide those columns, column IDs start at 0, and multiple columns are separated by ","
stretchcolumns– set automatic stretching of those columns, column IDs starting from 0, multiple columns words with "," delimited
Shrinkcolumns-Set auto-shrink those columns, column IDs starting from 0, multiple columns with "," delimited
You can use "*" to represent all columns, and the same column can be set to shrinkable and stretchable at the same time.
Android:layout_column specifies that the cell is displayed in the first column
ANDROID:LAYOUT_SPAN Specifies the number of columns that the cell occupies (when unspecified, 1)
Tip:tablerow is also a layout, inside the elements will be arranged horizontally, if TableRow's parent element is not tablelayout, then he will behave like a linearlayout.
Android user Interface ViewGroup (framelayout linearlayout absolutelayout relativelayout tablelayout)