The UI Layout of Android uses Layout as the container, and controls are arranged according to the rules above, which is similar to Swing and LWUIT in JAVA. Controls and Layout have many attributes that can be modified in Properties, similar to RAD such as. NET/Delphi. The most common attributes include the following:
Id = "@ + id/edtInput", which is a bridge between the UI and code
Gravity = "center", controls in Layout are centered
Layout_width = "fill_parent", automatically filled to the screen width. The same applies to layout_height.
Layout_width = "wrap_content", automatically filled into the control size, the same as layout_height
LinearLayout: The Layout used in the first article is LinearLayout. Its understanding is simple: the controls in LinearLayout are arranged horizontally or vertically:
Orientation = "horizontal": horizontal arrangement; orientation = "vertical": vertical arrangement
When LinearLayout is horizontal and the control in it uses layout_width = "fill_parent", the second group of controls will block the right side of the screen, that is, they will not be seen...
AbsoluteLayout is a layout defined by absolute coordinates. Because absolute coordinates are used to locate controls, AbsoluteLayout should be used less to implement adaptive interfaces. The controls in AbsoluteLayout use layout_x and layout_y to define their positions:
In TextView01, the X coordinate is 10px, And the Y coordinate is 10px:
View plaincopy to clipboardprint?
<AbsoluteLayout android: id = "@ + id/AbsoluteLayout01" android: layout_height = "wrap_content" android: layout_width = "fill_parent">
<TextView android: text = "TextView01" android: id = "@ + id/TextView01" android: layout_height = "wrap_content" android: layout_y = "10px" android: layout_width = "wrap_content" android: layout_x = "110px">
</TextView>
</AbsoluteLayout>