Android's layout:
1. Linear layout: Components that are laid out in a vertical or horizontal direction.
2. Relative layout: How the layout is relative to the other components.
3. Absolute layout: Components that are laid out in absolute coordinates.
4. Table layout: Components that are laid out in rows and columns.
5. Frame layout: Components from the top left of the screen layout component.
Linear layout:
is one of the most commonly used layouts in Android development, which is laid out vertically or horizontally, and can be set in the direction of a linear layout through the "Android:orientation" property. Property values are both vertical and horizontal.
Common Properties:
Android:orientation: You can set the orientation of the layout.
Android:gravity: Used to control how components are aligned.
Layout_weight: Controls the relative size of each component in the layout.
2. Relative layout relativelayout:
Relativelayout completes the layout according to the position between the child elements. The properties of the child elements in this layout will take effect. For example, Android:layout_bwlow and Android:layout_ablove and so on. The child elements specify a positional relationship through these footage and the pigeon's ID mate. Note When you specify a location relationship, the ID of the reference must be defined before the reference, or an exception will occur. The properties commonly used in the
Relativelayout are as follows:
Android:layout_toleftof on the left side of the component
Android:layout_torightof on the right side of the component
Android: Layout_above the component is located above the component
Android:layout_below the component is under the component
Android:layout_alignparentleft the component is on the left side of its parent component
Android:layout_alignparentright whether the component is on the right side of its parent component,
Android:layout_alignparenttop whether the component is on top of its parent component
Android:layout_ Alignparentbottom whether the component is centered on the bottom of its parent component
Android:layout_centerinparent If the component is relative to the parent component
Android:layout_ Centerhorizontal whether the component is centered horizontally
Android:layout_centervertical whether the component is centered vertically
3. Absolute layout: Absolutelayout: Is an absolute layout, in which the android:layout_x and android:layout_y properties of the child elements in this layout are in effect and are used to describe the coordinate position of the child element. The upper left corner of the screen is the origin of the coordinates, the first 0 indicates the horizontal axis, the second is the ordinate, and the value increases. Child elements in this layout can overlap each other. This layout is usually not used in timing development. Because his layout code is too rigid. Can not be well matched to various terminals.
4. Form layout: Tablelayout, this layout is the form layout, suitable for n row n column layout format. A tablelayout is made up of many talberow, and a tablerow represents a row in tablelayout.
TableRow is a subclass of LinearLayout, whose android:orientation attribute value is horizontal, and his android:llayout_wdith and Android:layout_ The Height property is match_parent and Wrap_content. So his sub-elements are arranged horizontally, and the width and height are consistent. This design makes the child elements in each TableRow equivalent to the table cells. In TableRow, cells can be empty, but cannot span columns.
<tablerow
Android:layout_width= "Fill_parent"
android:layout_height= "Fill_parent"
>
</TableRow>
5. Frame layout: Framelayout is the simplest of the 5, in this layout, the entire interface is used as a blank area, all the child elements can not be assigned to the location, they are all placed in the upper left corner of the area of this position. Then block the previous element. The second one masks the first one, the third one obscures the second.
The difference between android:layout_width and andoird:layout_height of wirelessly:
1. Each view must define two properties that are Layout_width and layout_height, and the values of these two properties can only be selected between Match_parent and Wrap_content and fill_parent. Note: Match_parent and fill_parent are actually the same effect and can be found in the middle of ViewGroup's inner class. Are-1.
2.fill_parent and Match_parent are two ways of representing the width or height of a view that will be equal to the width and height of the parent control, and wrap_content this way represents the width of the view as determined by the internal content.
3.orientation if the horizontal direction, then the layout_weight is the horizontal direction of the proportional size, vertical direction of the same.
4.android:width and Android:height, even with these two attributes, there is no need to declare them. Used to control the exact size of the view. such as: 64dp,1px. This property can be found in TextView, but is not normally used. It is only used when the definition is precise.
5.android:gravity this is for the element of the control, which controls where the element is displayed in the control, for example, setting two properties in a button control.
Android:gravity= "left" and android:text= "commit", this time the text on the button, android:layout_gravity, is used to control the position of the control in the Axe control containing the control, similarly, When we set the android:layout_gravity= "left" property in the button control, the button is said to be located at the right-hand side of the interface.
Android layout and the like