

Let’s start with the initial XML layout of this activity. This is the end result that we want to achieve Rather than explaining, let’s just walk through an example. In it’s simplest form, ConstraintLayout gives you the ability to animate between two sets of constraints through the TransitionManager (available on API 19+ or via the support library). For the purposes of animations, it’s also good to take a peek at the generated XML to get a better understanding of the various constraint attributes so you know how to manipulate them.

Most of the tutorials on ConstraintLayout focus on using the newly improved Android Studio layout design panel where you can drag/drop/visualize the various constraints. you know what is app:layout_constraintLeft_toLeftOf and its relatives). I’m going to assume that you know the basics of ConstraintLayout (e.g.

But there is one other benefit of ConstraintLayout that most people are unaware of and the official documentation curiously doesn’t mention anything about: performing cool animations on your ConstraintLayout views with very little code. Flattening your view hierarchy, improving performance, supporting arbitrary bounding rules - it promises to fix all of the shortcomings of some previous layout files (* cough* I’m looking at you RelativeLayout * cough*) and more. ConstraintLayout seems to be the hot new thing nowadays.
