Constraint layout
Learn about constraints
Constraint bias
Constraint bias positions the view element along the horizontal and vertical axes. By default, the view is centered between the two constraints with a bias of 50%.
Important: When developing real-world apps, use flexible constraints for the height and width of your UI elements, whenever possible. For example, use match_constraint or wrap_content. The more fixed-size UI elements you have in your app, the less adaptive your layout is for different screen configurations.
Wrap Content: The view expands only as much as needed to contain its contents. Fixed: You can specify a dimension as the view margin in the text box next to the fixed-constraint arrows. Match Constraints: The view expands as much as possible to meet the constraints on each side, after accounting for the view’s own margins. This constraint is very flexible, because it allows the layout to adapt to different screen sizes and orientations. By letting the view match the constraints, you need fewer layouts for the app you’re building.
You should avoid using match parent while using constraint layout because then contraints applied have no effect on views.
Chains A chain is a group of views that are linked to each other with bidirectional constraints. The views within a chain can be distributed either vertically or horizontally. For example, the following diagram shows two views that are constrained to each other, which creates a horizontal chain.
Head of the chain The first view in a chain is called the head of the chain. The attributes that are set on the head of the chain control, position, and distribute all the views in the chain. For horizontal chains, the head is the left-most view. For vertical chains, the head is the top-most view. In each of the two diagrams below, “A” is the head of the chain.
Thanks for reading!