– Constraints held up transitively – View has no margin – Extra margins to View.GONE targets possible • For example: layout_goneMarginStart="16dp" • Currently XML only
with bias – Determines the positioning of the packed chain – spread – spread inside • Variation: spread with weights (as with LinearLayout) – Determines the distribution of chain elements
set.clone(layout); set.clear(R.id.btn_move); set.constrainHeight(R.id.btn_move, ConstraintSet.WRAP_CONTENT); set.constrainWidth(R.id.btn_move, ConstraintSet.WRAP_CONTENT); set.connect(R.id.btn_move, ConstraintSet.START, ConstraintSet.PARENT_ID, ConstraintSet.START, margin); // another connect for vertical position also needed set.applyTo(layout);
set.clone(layout); set.clear(R.id.btn_move); set.constrainHeight(R.id.btn_move, ConstraintSet.WRAP_CONTENT); set.constrainWidth(R.id.btn_move, ConstraintSet.WRAP_CONTENT); // another connect for vertical position also needed set.connect(R.id.btn_move, ConstraintSet.START, ConstraintSet.PARENT_ID, ConstraintSet.START, margin); set.applyTo(layout);
to handle • CL less powerful – Inequalities and priorities • Android's XML easier to understand • No guidelines in AutoLayout • View.GONE equivalent in AutoLayout requires ton of extra work
margins • LE looses zoom level when switching view types • LE doesn‘t always show bias handles • LE has difficulties with start/end • Conversion of Layouts in 2.4 buggy
the docs: ConstraintLayout is available as a support library ... As such, we are planning in enriching its API and capabilities over time. https://developer.android.com/reference/android/support/constraint/Constraint Layout.html