1 Layout Parameters
Some property names start with "Layout_", such as Android:layout_marginleft, while other property names are not.
A property whose name does not start with "layout_" acts on the component. When a component is generated, a method is called to configure itself according to the property and property values;
A property whose name begins with "Layout_" acts on the parent component of the component. These properties are also called layout parameters. They are responsible for informing the parent component of how to schedule its own subcomponents internally. That is, as long as the layout parameter is included, it has its own parent component.
2 inner and outer margins
Inner margin: android:padding
Outer margin: android:layout_marginxxx
As described in the 1th, the margin is to tell the parent component how much of an edge is spaced when the subassembly is laid out. The meaning of the padding is that when plotting itself, it is much less than what is contained.
3 Add the corresponding horizontal mode for the default generated layout
When the screen rotates, the default generated layout rotates accordingly, but the part of the component is mechanically stretched and re-adjusted itself and its own subcomponents. How to adjust the layout of the horizontal mode effectively according to your needs? To achieve this, you can try the following steps:
- To create the Res/layout-land directory, copy the layout files from the Res/layout directory to the Res/layout-land directory;
- By changing the layout file under the Res/layout-land directory, the goal of self-modifying horizontal layout is achieved.
4 How the Android:layout_weight property works
This property tells the LinearLayout (parent component) How the subassembly is arranged. When determining the display width of the subassembly view, LinearLayout uses the mixed values of layout_weight and layout_width. The main points are completed in two steps:
- LinearLayout View Layout_width property values (view Layout_height property values vertically). Suppose you currently have a horizontal linearlayout that contains two subcomponents: a button and a checkbox, and they display different lengths of text information, and they cannot fill the entire linearlayout in the case of their respective wrap_content. After the arrangement, there is additional space (extra spaces).
- LinearLayout Check the Layout_weight property value. Depending on the value of the Layout_weight attribute, the LinearLayout allocates additional space to each sub-component as a proportion.
[Android] (Learn note 2) drill down into XML layout properties