Thursday, December 17, 2020

ConstraintLayout 2.1.0 alpha 2





We are happy to announce the release of ConstraintLayout 2.1.0 alpha 2, with many new features :)

dependencies {
    implementation 'androidx.constraintlayout:constraintlayout:2.1.0-alpha2'
}


What's new in 2.1.0 alpha 2

More information about the new features in 2.1.0 can be found on the wiki, the source code is available on https://github.com/androidx/constraintlayout

ConstraintLayout



  • android:layout_width and android:layout_height are now optional, with wrap_content as default behavior
  • new layout_constraintWidth and layout_constraintHeight attributes for expressing dimension constraints
  • supports negative margins for constraints
  • supports baseline to top and baseline to bottom constraints
  • supports baseline margin constraints
  • SharedValues allow to inject external values into ConstraintLayout

MotionLayout


  • Support for overshoot interpolators (anticipate, overshoot)
  • Enhanced MotionHelper support
  • Add animated update of ConstraintSet to MotionLayout updateStateAnimate(id,cset,duration);
  • Shared value based ViewTransition
  • scheduleTransitonTo allow you to que a transition to run at the completion of the current transition.

Helpers

  • Carousel now supports an infinite (wrap-around) mode
  • ReactiveGuide : A guideline that position itself automatically when a SharedValue changes
  • MotionEffect : inject Keyframes to referenced views moving in a given direction
  • MotionLabel - A View for animating single line text

Changes


ConstraintLayout.LayoutParams now inherits directly from ViewGroup.LayoutParams, not ViewGroup.MarginLayoutParams.

Fixes


  • vertical ratio incorrectly resolved
  • percent dimension with max dimensions