Encapsulate Behaviors ConstraintLayout utility Encapsulate a given behavior Apply it to a set of widgets ▸ Supported in Studio ▸ Can use View APIs (animation, etc.) in helpers to promote reuse
public class MetaballsDecorator extends ConstraintHelper { public void updatePostLayout(ConstraintLayout container) { int[] ids = getReferencedIds(); final int count = ids.length; for (int i = 0; i < count; i++) { View view = container.getViewById(ids[i]); // do something } } @Override public void onDraw(Canvas canvas) { // do something } }
MotionLayout Reflect and animate between multiple states of components Coordinating motion of multiple components Support nesting MotionLayout Drive custom views
MotionLayout Reflect and animate between multiple states of components Coordinating motion of multiple components Support nesting MotionLayout Drive custom views
MotionLayout Subclass of ConstraintLayout Gets its constraints from a separate xml file. Allows you to directly animate between two Constraint sets Extensive control of the Transition between the two Custom attributes — not just layout
alpha 4 Richer behaviors for OnClick actions CustomAttributes support for customPixelDimensions ImageFilterView overlay support KeyTrigger collision support Attributes rename
motion:constraintSetStart="@+id/a" motion:constraintSetEnd=“@+id/b" motion:autoTransition="animateToStart" motion:duration=“1000"/> Auto Transition A B Transition
Flow modes 1. Apply an horizontal or vertical chain to the elements 2. Wrap elements as needed, using chains 3. Wrap elements as needed, aligning in rows & columns
developer.android.com https://developer.android.com/reference/android/support/constraint/classes.html Medium Articles: Introduction to MotionLayout part I http://bit.ly/2O4AmIz Introduction to MotionLayout part II http://bit.ly/2uPuWbw Introduction to MotionLayout part III http://bit.ly/2zRjCSj Introduction to MotionLayout part IV http://bit.ly/2QqfJaF Github: https://github.com/googlesamples/android-ConstraintLayoutExamples Documentation