To work with ConstraintLayout, you need Android Studio Version 2.2 or newer and have at least version 32 (or higher) of Android Support Repository.
build.gradle
file:dependencies {
compile 'com.android.support.constraint:constraint-layout:1.0.2'
}
To add a new constraint layout to your project:
New > XML > Layout XML.
"android.support.constraint.ConstraintLayout"
for the Root Tag.Otherwise just add in a layout file:
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
</android.support.constraint.ConstraintLayout>