ConstraintLayout
Constraintlayout allow you to create more complex or difficult and large view hierarchy with simple steps. It keeps your hierarchy more flat and readable. It may be the similar to the relative layout where all the views are placed between the relations between them but the constraintlayout is more flexible than relative layout. You can use constraintlayout with the new Android studio's layout editor.
Build a responsive UI with constant layout
With the powerful utility of the constraint layout you can bill and responsive UI that is compatible with all size of devices that users have if your app installed.
How to position the views
Define the position of the views in the constraint layout you must give the views one horizontal and vertical constraint. after dragging the view to the layout you have to give the layout constraints at first it has no constraints you can see the view has four handles to the four sites drag each handle to the corner of the sites to make the constraints.
Although the missing constant don't cause the compilation error but it may ruin layout look.
To see the error click here Show Warnings and Errors . It helps to about missing constraint, the layout editor can automatically at constraint to your views to its auto connect features.
Although the missing constant don't cause the compilation error but it may ruin layout look.
To see the error click here Show Warnings and Errors . It helps to about missing constraint, the layout editor can automatically at constraint to your views to its auto connect features.
Steps you must follow
- Dragon view from the pallet window to the editor.
- Click view to select it.
- Click the constraint hundred and regard to the anchor point. This point can be the edge the another view or edge of the layout or the guideline.
- When constraint is created editor gives the default margin to the views to separate them.
- Every view must have two constraint :one horizontal and one vertical.
- Click the constant to select it and press the delete button from keyboard to delete it .
- Or you can click the candles in the property panel to delete the constant.
Adjust the constraint bias
When you add both opposite constant to end view you can see slider in the property window by default it is set to 50% you can change the position of the view with the slider that you required.
Adjust the margins
Click here in the toolbar to adjust the margin by default.
0 Comments