Constraintlayout

Position and size widgets in a flexible way with relative positioning.

This table lists all the artifacts in the androidx.constraintlayout group.

Artifact Current Stable Release Next Release Candidate Beta Release Alpha Release
constraintlayout 2.0.4 - 2.1.0-beta02 -
constraintlayout-compose - - - 1.0.0-alpha06
This library was last updated on: May 4, 2021

Declaring dependencies

To add a dependency on ConstraintLayout, you must add the Google Maven repository to your project. Read Google's Maven repository for more information.

Add the dependencies for the artifacts you need in the build.gradle file for your app or module:

dependencies {
    implementation "androidx.constraintlayout:constraintlayout:2.0.4"
    // To use constraintlayout in compose
    implementation "androidx.constraintlayout:constraintlayout-compose:1.0.0-alpha06"
}

For more information about dependencies, see Add build dependencies.

Feedback

Your feedback helps make Jetpack better. Let us know if you discover new issues or have ideas for improving this library. Please take a look at the existing issues in this library before you create a new one. You can add your vote to an existing issue by clicking the star button.

Create a new issue

See the Issue Tracker documentation for more information.

ConstraintLayout-compose 1.0

ConstraintLayout-compose 1.0 provides ConstraintLayout functionalities in Jetpack Compose.

Version 1.0.0-alpha06

May 4, 2021

androidx.constraintlayout:constraintlayout-compose:1.0.0-alpha06 is released.

  • Compose optimisation: Constraintlayout inline composable (#193)
  • Minimize remeasurements in Compose (#210)

Version 1.0.0-alpha05

March 15, 2021

androidx.constraintlayout:constraintlayout-compose:1.0.0-alpha05 is released.

  • includes a fix for the optimization engine (b/182657720)
  • add a optimizationLevel parameter to the ConstraintLayout copmosable

Version 1.0.0-alpha04

March 11, 2021

androidx.constraintlayout:constraintlayout-compose:1.0.0-alpha04 is released.

Update to use the latest constraintlayout-core engine

Version 1.0.0-alpha03

February 24, 2021

androidx.constraintlayout:constraintlayout-compose:1.0.0-alpha03 is released.

Release update for Jetpack Compose beta01 release

Version 1.0.0-alpha02

February 10, 2021

androidx.constraintlayout:constraintlayout-compose:1.0.0-alpha02 is released.

Release update for Jetpack Compose alpha12 release

Version 1.0.0-alpha01

February 2, 2021

androidx.constraintlayout:constraintlayout-compose:1.0.0-alpha01 is released.

First release of the library, providing inline and external DSLs to express constraints.

Version 2.1

ConstraintLayout 2.1.0 provides richer features in MotionLayout and new helpers (Carousel, etc.)

Version 2.1.0-beta02

May 4, 2021

androidx.constraintlayout:constraintlayout:2.1.0-beta02 is released.

A few new features in MotionLayout:

  • OnSwipe enhancement including spring (stiffness, damping, mass etc) & never complete
  • jumpToState function
  • ViewTransition downUp mode where on touch Down it plays to 100 and on up reverses to 0

Various fixes, notably:

  • Fix problem in MotionLayout with vertical scroll (#173)
  • Perf improvements on nested MotionLayout (#189)
  • Fast transition with NestedScrollView in MotionLayout (#189)
  • ConstraintSet gone in MotionLayout (#189)
  • Support downUp ViewTransitions in MotionLayout (#190)
  • Fix in ImageFilter when reusing drawables (#192)
  • Add spring support in MotionLayout (#199)
  • Performance improvement to CircularFlow (#200)
  • Fixes in derived constraints / constraint override (#212)

Version 2.1.0-beta01

March 11, 2021

androidx.constraintlayout:constraintlayout:2.1.0-beta01 is released.

ConstraintLayout

android:layout_width and android:layout_height are back being non-optional due to compatibility issues.

MotionLayout

  • Programmatic support for inserting and removing onSwipe and onClick on Transitions
  • Experimental Support for Transitions through screen rotation
  • support duration argument to transitions
  • Better support for customAttributes that are boolean or References

Helpers

  • added a way to animate or jump directly to a given item of a Carousel
  • new CircularFlow helper

See additional information on this release here and bugs closed.

Version 2.1.0-alpha2

December 17, 2020

androidx.constraintlayout:constraintlayout:2.1.0-alpha2 is released.

This second alpha adds several new features:

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

See additional information on this release here.

Version 2.1.0-alpha1

November 19, 2020

androidx.constraintlayout:constraintlayout:2.1.0-alpha1 is released.

First alpha of the 2.1 release. Introduces support for:

  • Carousel motion helper, to build custom carousel views
  • MotionLayout scenes supports include and constraints override
  • MotionLayout adds richer support for rotation (input and output)
  • MotionLayout adds ViewTransitions, allowing single view transitions for mutation of constraintsets

See additional information on this release here.

Version 2.0

ConstraintLayout 2.0 adds new features for layouts (virtual layouts, etc.) and a new class for simplifying animation of views, MotionLayout.

Version 2.0.4

October 29, 2020

androidx.constraintlayout:constraintlayout:2.0.4 is released.

Bug Fixes

This releases fixes a potential NPE that may happen when removing a child view at runtime. It is recommended to update to this version.

See the list of closed issues here.

Version 2.0.3

October 27, 2020

androidx.constraintlayout:constraintlayout:2.0.3 is released.

Bug Fixes

This releases fixes a few issues. It is recommended to update to this version.

  • Windows insets handling
  • Handling of dimension ratio in some situations
  • Crash with some RTL layouts

See the list of closed issues here.

Version 2.0.2

October 6, 2020

androidx.constraintlayout:constraintlayout:2.0.2 is released.

Bug Fixes

This releases improves performances as well as fix a few issues. It is recommended to update to this version.

  • Handling of view GONE visibility in ConstraintLayout was incorrect in some situations
  • Handling of packed chains in ConstraintLayout was incorrect in some situations
  • Fixed inflation exception on API 15 for the Flow virtual layout helper
  • limitsBoundsTo was broken in MotionLayout
  • jump to end was broken in MotionLayout in some situations (chaining transitions)

See the list of closed issues here.

Version 2.0.1

August 25, 2020

androidx.constraintlayout:constraintlayout:2.0.1 is released.

This is a minor update enabling the use of the MotionEditor in Android Studio.

Version 2.0.0

August 21, 2020

androidx.constraintlayout:constraintlayout:2.0.0 is released.

Bug Fixes

See the list of closed issues here.

Notable fixes are:

  • MotionLayout Transition delays & TransitionListener fixes
  • ConstraintLayout flow & barrier fixes

Version 2.0.0-rc1

July 29, 2020

androidx.constraintlayout:constraintlayout:2.0.0-rc1 is released.

Bug Fixes

See the list of closed issues here.

Notable fixes are:

  • Flow fixes
  • RecyclerView fixes (we recommend to update to recyclerview 1.2.0 alpha 5 or later)
  • MotionLayout TransitionListener fixes
  • MotionLayout memory leak fix

Version 2.0.0-beta8

July 7, 2020

androidx.constraintlayout:constraintlayout:2.0.0-beta8 is released.

Bug Fixes

See the list of closed issues here.

Notable fixes are:

  • Placeholder behavior
  • Layer visibility
  • Flow, Barrier fixes
  • TransitionListener fixes

Version 2.0.0-beta7

June 12, 2020

androidx.constraintlayout:constraintlayout:2.0.0-beta7 is released.

Bug Fixes

See the list of closed issues here.

Notable fixes are:

  • Nested scroll view issues in MotionLayout
  • Transition listener issues with MotionLayout
  • Memory leak in MotionLayout
  • RecyclerView issues
  • Group visibility
  • Padding issues

Version 2.0.0-beta6

May 13, 2020

androidx.constraintlayout:constraintlayout:2.0.0-beta6 is released.

Bug Fixes

See the list of closed issues here. Notable fixes are group visibility handling and derived constraints issues in MotionLayout.

Version 2.0.0-beta5

May 7, 2020

androidx.constraintlayout:constraintlayout:2.0.0-beta5 is released.

Bug Fixes

See the list of closed issues here

Version 2.0.0-beta4

December 16, 2019

androidx.constraintlayout:constraintlayout:2.0.0-beta4 is released.

New Features

MotionLayout

New attributes in Transition:

  • layoutDuringTransition : let you configure how MotionLayout should react to children's requestLayouts calls during a transition. Possible values are {ignoreRequest, honorRequest}
  • pathMotionArc : the path taken by elements moving will use an arc. Possible values are {startVertical | startHorizontal | flip | none }

A default transition is now possible to define, simply by omitting the start and end ConstraintSets. That default transition will be used if no other existing transition can be found to match the current start/end states.

Bug Fixes

See the list of closed issues here