ConstraintLayout - An Introduction
ConstraintLayout is an Android ViewGroup which allows you to position and size widgets in flexible way. It helps in building complex UI layouts with flat-hierarchy. Known for the highest level of resource optimization.

ConstraintLayout has only one direct class which is MotionLayout.
What is Constraint?
Defined in English as “a limitation or restriction”. Constraints defines a relation between 2 widget which will define how those widgets will be positioned in the layout.
A few things to note:
A few things to note:
- Every view should have at least one constraint in its X and Y axes. If we don’t give the constraint the view will be move to its default position along that specific axis.
- It can only set constraint along the same plan i.e vertical plan of a view can be constraint with vertical plan of another view, baselines can constraint to another baseline.
- Each constraint handle can be used for just one constraint, but you can create multiple constraints (from different views) to the same anchor point.
Comments
Post a Comment