We are happy to announce the release of ConstraintLayout 2.0 beta 2.

It’s available from the google maven repository:

dependencies {

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

}

or if using the AndroidX packages:

dependencies {

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

}

Examples are available on

flow_lastHorizontalStyle :

spread|spread_inside|packed

flow_lastVerticalStyle :

spread|spread_inside|packed

flow_lastVerticalBias :

float

flow_lastHorizontalBias :

float

Transition ID

< Transition android :id ="@id/tobigsceen" ...

Transition Disable

Transition

transitionDisable

Transition.setEnable(true)

Transition.isEnabled()



Important: This replaces the callback “ allowsTransition ” in the interface MotionLayout.TransitionListener



View Velocity public void getViewVelocity(View view, float posOnViewX, float posOnViewY, float [] returnVelocity, int type) {

Accessing the Velocity of an animating view. You can get the velocity a view is moving at.

It takes the coordinate on the view and returns the velocity of the view.

There are 4 types of velocities it can return. It can return static or dynamic, pre or post layout.



The static velocity does not incorporate the actual motion driven by touch.





public final static int VELOCITY_POST_LAYOUT = 0 ; public final static int VELOCITY_LAYOUT = 1 ; public final static int VELOCITY_STATIC_POST_LAYOUT = 2 ; public final static int VELOCITY_STATIC_LAYOUT = 3 ;

To aid in understanding how to use it, we have included a utility view MotionTelltales based on MockView but showing the velocity of 25 points on the view.







Key Trigger redirection

Now a KeyTrigger can trigger a method on another view using the attribute triggerReceiver.



< KeyTrigger motion :triggerReceiver ="@+id/view" ...

: This replaces the callback “” in the interfaceAccessing the Velocity of an animating view. You can get the velocity a view is moving at.It takes the coordinate on the view and returns the velocity of the view.There are 4 types of velocities it can return. It can return static or dynamic, pre or post layout.The static velocity does not incorporate the actual motion driven by touch.Now a KeyTrigger can trigger a method on another view using the attribute triggerReceiver.

Bugfixes











Motion Layout nested scrolling issue 133624931 Alpha 4 Layout Weights not working properly 130580479 ConstraintLayout does not respect minHeight with wrap_content 130437914 [MotionLayout] getProgress() Value Gets Reset When The Container Layout Animates. 112521093 [MotionLayout] Fragments in ViewPager sometimes are not drawn 123379505 MotionLayout animation does not work inside fragment 122929956 ConstraintLayout:2.0.0-alpha4 no longer preserves view scaling properly with MotionLayout 130115829 Child view not centered when ConstraintLayout size changes 133273843 [ConstraintLayout 2.0.0-alpha5] Regression in MotionLayout when scrolling a scrollable view 131572132 Height of nested constraint layout child not measured correctly in ConstraintLayout 2.0.0-alpha4+ (including beta1) 133202039 [ConstraintLayout 2.0.0-alpha5] Regression in MotionLayout modifying a ConstraintSet 131874827 Constrain Layout 2.0.0 Alpha 4 to Beta 1 134841040 Flow verticalAlign="baseline" not working 134533710 ConstraintLayout Group and Barrier is not working in dynamic feature module. 133032779 ConstraintLayout:2.0.0-alpha4 MotionLayout does not respect parent padding 130561744 app:showPaths crashes on transition with a duration smaller than 16 ms 134086361 PlaceHolder doesn't display 132951221 [MotionLayout] Migrate MotionLayout to NestledScrolling3 and override functionality 128914828 Maybe useless code in MotionLayout class 131532235 Placeholder emptyVisibility attribute is incorrect 131747094 Barrier is ignored 132651309 Request to programmatically change autoTransition 132878306 Handle Snackbar + FAB with MotionLayout 133541548 Problem when trying to wrap chains of width-constrained views 134137982 MotionLayout animating incorrectly when used in a recyclerview 118289003 Animatinos in recyclerview end in unexpected states 118289936 TextView is clipped when using nested ConstraintLayouts and constraintDimensionRatio 134082517 android:gravity does not work as expected in ConstraintLayout 2.0.0-alpha4+ (including beta1) 132651320 2.0 B1 bug / changed behavior 133465553 ConstraintLayout does not measure height correctly when using wrap_content and layout_constrainedHeight is set to true. 132314169 ConstraintLayout will not wrap TextView to the correct height when using wrap_content and app:layout_constrainedHeight="true" 123551995 Buttons in Flow has text aligned to left (and alignment behaves strange) 133809201 adding constarint from kotlin is not respected in beta , works fine in alpha2 version 133184664 When the View referenced by Flow has a child View, the layout is wrong. 133092993 Flow does not work well with 0dp 133326448 MotionLayout not triggering animation after scrolling a list 122676392 Setting MotionScene in code to MotionLayout (Not working same as if we set layoutDescription in MotionLayout in xml) 116674308 Allow KeyTrigger to call methods on a different view 132457332 Constraint not respected when using the ID of the parent instead of `parent` in XML. 133201550 Several issues where fixed in beta 2:

You can now name transitions with an ID using the attributeMotionScene.Transition MotionLayout.(int id)Now you can disable and enable Transitions in XML and programmatically. A <> now has an attribute. You can also enable or disable them programmatically withand query with