Add ConstraintLayout to your project
To use ConstraintLayout
in your project, proceed as follows:
- Ensure you have the latest Constraint Layout library:
- Click Tools > Android > SDK Manager.
- Click the SDK Tools tab.
- Expand Support Repository and then check ConstraintLayout for Android and Solver for ConstraintLayout. Check Show Package Details and take note of the version you're downloading (you'll need this below).
- Click OK.
- Add the ConstraintLayout library as a dependency in your module-level
build.gradle
file:dependencies { compile 'com.android.support.constraint:constraint-layout:1.0.0-alpha8' }
The library version you download may be higher, so be sure the value you specify here matches the version from step 3.
- In the toolbar or sync notification, click Sync Project with Gradle Files.
Now you're ready to build your layout with ConstraintLayout
.