How to use the new Android Constraint Layout to reduce View hierarchy

Bogdan M. picture Bogdan M. · May 19, 2016 · Viewed 32.3k times · Source

Do you have any idea on how to use the new Constraint Layout that was recently announced at this year's Google I/O?

Answer

Adrian Olar picture Adrian Olar · May 19, 2016

You can go to an existing layout resource file, open the visual editor and right-click on a RelativeLayout (for example) and click the option to convert to a constraint layout.

You also have to add the Gradle dependency in build.gradle file:

compile 'com.android.support.constraint:constraint-layout:1.0.0'