Source code for the app and examples from Huyen's talk "Cool ConstraintLayout 2.0"
Each branch represents a completed step in the MotionLayout
demos.
master
: code before live coding demo.
01_new_features_barrier
: addBarrier
for positioning image relative to title and description text.02_new_features_group
: useGroup
for toggling visibility of previous barrier example code.03_new_features_percent_constraints
: change view widths using percent constraints04_new_features_circular_constraints
: position icons using circular constraints. Add a secondImageView
constrained to the first using circular constraints as well.05_new_Features_placeholders
: use placeholders to swap anImageView
between two positions. Add a secondImageView
and use placeholders to swap positions.06_motionlayout_layout_refs
: switch from using a pair ofConstraintSet
instances toggled in code to using aMotionScene
whereapp:constraintSetStart
andapp:constraintSetEnd
are the layouts we used with theConstraintSet
in code.07_motionlayout_all_in_one_scene
: switch to using aMotionScene
where we define the start and end states asConstraintSet
tags inside of theMotionScene
. Here we animate justicon_android
.08_motionlayout_all_in_one_scene_complete
: add<Constraint>
tags that we did not animate in07_motionlayout_all_in_one_scene
. Basically, we are recreating the transition from06_motionlayout_layout_refs
completely in aMotionScene
.09_motionlayout_custom_attribute
: use a<CustomAttribute>
tag inside a<Constraint>
to interpolate the color of anImageView
.10_motionlayout_keyposition
: add a keyframe to haveicon_cloud_02
move to 100% across the parent's X-axis at key position 20.11_motionlayout_keyattribute
: add a keyframe to haveicon_android
become red at key position 50.12_motionlayout_onclick
: add transition toggle trigger for when user clicks onicon_cloud_01
.13_motionlayout_imagefilterview
: changeicon_android
to useImageFilterView
that crossfades between two image drawables.14_motionlayout_seekbar
: link the changes in aSeekBar
to theMotionLayout
to drive the transition.
Huyen Tue Dao
Twitter | Android Dialogs | Randomly Typing