Build a Responsive UI with ConstraintLayout

来源:互联网 发布:宏正软件 编辑:程序博客网 时间:2024/05/17 22:32

Add ConstraintLayout to your project


To use ConstraintLayout in your project, proceed as follows:

  1. Ensure you have the latest Constraint Layout library:
    1. Click Tools > Android > SDK Manager.
    2. Click the SDK Tools tab.
    3. 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).

    4. Click OK.
    5. 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.

    6. In the toolbar or sync notification, click Sync Project with Gradle Files.

Now you're ready to build your layout with ConstraintLayout.


使用方法:https://developer.android.com/training/constraint-layout/index.html
1 0