We just released ConstraintLayout 2.0.0 alpha 4. It’s available from the google maven repository:

dependencies {

implementation 'com.android.support.constraint:constraint-layout:2.0.0-alpha4'

}

or if using the AndroidX packages:

dependencies {

implementation 'androidx.constraintlayout:constraintlayout:2.0.0-alpha4'

}

Changes

This release contains various bug fixes and performance improvements:

ConstraintLayout

Dynamic feature modules fix when using barriers and helpers

Chain fixes (bias with gone elements, RTL fixes)

Barrier fixes (RTL behavior, now can use a margin on a Barrier)

match_constraints fixes (max support, bias, percent…)

setTag/getTag on Group was fixed

ConstraintSet::setGoneMargin() for Top/Bottom

baseline behavior on gone

wrap behavior fixes

MotionLayout

Visibility fixes

Flickering issues / jump issues fixed

Various match_constraints issues fixed

Custom color interpolation (alpha was incorrectly handled)

Better barrier / helpers support

New Features





We also added several new features to MotionLayout:

Richer behaviors for OnClick actions

CustomAttributes support for customPixelDimensions

ImageFilterView overlay support

KeyTrigger collision support

Attributes rename

OnClick

OnClick now supports a richer set of behaviours

Toggle - animate back and forth ( = transitionToEnd|transitionToStart)

transitionToEnd - animate to the end state

transitionToStart - animate to the start state

jumpToEnd - Jump to the end state

jumpToStart - Jump to the start state

These can be combined to allow jumping to the end but smooth transition to the start.

< OnClick motion :targetId ="@id/button_west" motion :clickAction ="transitionToEnd|transitionToStart" /> < OnClick motion :targetId ="@id/button_south" motion :clickAction ="jumpToStart|transitionToEnd" />

CustomPixelDimensions

Used when the method takes pixels such as setTextSize(...)

< CustomAttribute motion :attributeName ="textSize" motion :customPixelDimension ="2dp" />

ImageFilterView

New tag overlay - true(default) / false affects crossfade behaviour set to false to crossfade transparent objects.

KeyTrigger collision support





You can fire a KeyTrigger on collision with another view.

< KeyTrigger motion :motionTarget ="@id/button" motion :motion_triggerOnCollision ="@id/button2" motion :onPositiveCross ="callOnClick" motion :motion_postLayoutCollision ="true" />

motion_triggerOnCollision - Id of view to check collision with

motion_postLayoutCollision tested including layout or layout+transform

onPositiveCross Trigger on entering collision state

onNegativeCross Trigger on leaving the collision state

onCross Trigger on entering or leaving the collision state

Rename

To minimize the chance of name clashes with 3p libraries we have renamed attributes that were clashing or had a good chance of clashing.



