Android layout and android layout skills
1. LinearLayout
LinearLayout is one of the most common layout s in Android. It lists its child elements in one direction.
The direction can be either horizontal or vertical. In this direction, you can set Android: orientation = "vertical" or Android: orientation = "horizontal.
All elements are arranged one by one. If they are vertically arranged, the LinearLayout elements are arranged one by one vertically from the top down. If they are horizontally arranged, the elements in LinearLayout are arranged one by one from left to right.
2. FrameLayout
A FrameLayout object is like a blank area on the screen with a predefined number. Then, some elements can be filled in, such as an image.
Note that all elements are placed in the top left of the FrameLayout area. In addition, it is impossible to specify an exact location for these elements.
If a FrameLayout contains multiple child elements, the display of the child elements will overlap with the previous one.
3. RelativeLayout
This is a relative layout class. That is to say, RelativeLayout is a container. The elements in it, such as the Button, are calculated based on relative positions. For example, there are two buttons in a RelativeLayout. we can define the second Button on the top or right of the first Button. But where is the second Button? It depends on the position of the first Button. It should be noted that, in terms of performance, the computation at the precise position of the relative layout is only executed once. Therefore, if A visualization component B depends on, A must appear before B.
========================================================== ========================================
Android: id defines the component id
Android: layout_width defines the width of the component (wrap_content only wraps the content and fills the parent container with fill_parent)
Android: layout_height defines the height of the component.
Android: background = "@ drawable/blue" defines the background of the component.
Android: padding = "10dip", Android: margin = "10dip", dip is dependent on the pixel of the device. Padding indicates padding, while margin indicates padding.
Android: layout_below = "@ id/lable": place the current component under the id lable component
Android: layout_alignParentRight = "true", which is aligned with the right side of the parent container.
Android: layout_marginLeft = "10dip"
Android: layout_toLeftOf = "@ id/cancel", set this component to the left of the component whose id is cancel
Android: layout_alignTop = "@ id/cancel", set the height of this component to equal to that of the component whose id is cancel
========================================================== ========================================