Android has 6 most basic layout linear layouts (linearlayout), relative layouts (relativelayout), frame layouts (framelayout), grid layouts (GridLayout), absolute layouts (absolutelayout), There are also more complex layouts, such as constraintlayout, outside the table layout (tablelayout).
1. Advantages
More flexible and powerful when adjusting the position and size of controls.
2. Succession relations
Inherit from ViewGroup as with other layouts.
3. New features
Relative positioning:
<button android:id= "@+id/buttona" .../>
<button android:id= "@+id/buttonb" ...
app:layout_constraintleft_torightof= "@+id/buttona"/>
Right-aligned button A for button b
- Layout_constraintleft_toleftof//Left Justify left
- Layout_constraintleft_torightof//Left Right align
- Layout_constraintright_toleftof//Right-left align
- Layout_constraintright_torightof//Right-justified on right
- LAYOUT_CONSTRAINTTOP_TOTOPOF//top edge Alignment
- Layout_constrainttop_tobottomof//Align Top Bottom
- LAYOUT_CONSTRAINTBOTTOM_TOTOPOF//Bottom Top align
- Layout_constraintbottom_tobottomof//Bottom align below
- layout_constraintbaseline_tobaselineof//text content baseline Alignment
- Layout_constraintstart_toendof//Start side-to-tail alignment
- Layout_constraintstart_tostartof//Start edge aligned to start edge
- Layout_constraintend_tostartof//tail aligned to start edge
- LAYOUT_CONSTRAINTEND_TOENDOF//tail-aligned to tail
Outer margin:
<android.support.constraint.constraintlayout ...>
<button android:id= "@+id/button" ...
app:layout_constraintleft_toleftof= "Parent"
App:layout_constraintright_torightof= "parent/>
<android.support.constraint.ConstraintLayout/>
Spatial center Effect
Tendency:
<android.support.constraint.constraintlayout ...>
<button android:id= "@+id/button" ...
App:layout_constrainthorizontal_bias= "0.3"
app:layout_constraintleft_toleftof= "Parent"
App:layout_constraintright_torightof= "parent/>
<android.support.constraint.ConstraintLayout/>
Left 0.3, right 0.7
Performance of Visibility:
Dimension constraints:
Android:minwidth Setting the minimum width of the layout
Android:minheight Setting the minimum height of the layout
CHAIN:
Accessibility tools:
Android Constraintlayout Layout