1. 對(duì)其方式
例如:app:layout_constraintLeft_toRightOf="parent"
解釋:當(dāng)前控件左邊 與 夫控件的右邊 對(duì)其
app:layout_constraintLeft_toLeftOf="parent" // 也可以是其他控件的 id
app:layout_constraintLeft_toRightOf="@id/guideline_h"
app:layout_constraintRight_toLeftOf="@id/tv"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintTop_toBottomOf="parent"
app:layout_constraintBottom_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
2. 控制偏移
當(dāng)對(duì)其好了后可以設(shè)置偏移量
// 偏移
app:layout_constraintVertical_bias="0.9" // 移到垂直方向的 90% 位置
app:layout_constraintHorizontal_bias="0.8"
3. 控制寬高比
// 設(shè)置寬高比
app:layout_constraintDimensionRatio="16:6" // 默認(rèn) 寬:高
app:layout_constraintDimensionRatio="W,16:6"
app:layout_constraintDimensionRatio="H,16:6"
4. 鏈的樣式
左邊對(duì)其左邊控件的右邊,右邊對(duì)其右控件的左邊時(shí)
// 當(dāng)控件形成鏈時(shí)(左邊對(duì)其左邊控件的右邊,右邊對(duì)其右控件的左邊時(shí)),可以設(shè)置其鏈的樣式
app:layout_constraintHorizontal_chainStyle="packed" // spread_inside spread
app:layout_constraintVertical_chainStyle="spread"

5. 權(quán)重比
在鏈?zhǔn)讲季趾煤罂梢栽O(shè)置權(quán)重
// 權(quán)重比
app:layout_constraintHorizontal_weight="2"
app:layout_constraintVertical_weight="2"
一個(gè)鏈?zhǔn)讲季掷樱?/p>
// 布局方式:
<TextView
android:id="@+id/tab1"
android:layout_width="0dp"
android:layout_height="30dp"
android:background="#f67"
android:gravity="center"
android:text="Tab1"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toLeftOf="@+id/tab2" />
<TextView
android:id="@+id/tab2"
android:layout_width="0dp"
android:layout_height="30dp"
android:background="#A67"
android:gravity="center"
android:text="Tab2"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toRightOf="@id/tab1"
app:layout_constraintRight_toLeftOf="@+id/tab3" />
<TextView
android:id="@+id/tab3"
android:layout_width="0dp"
android:layout_height="30dp"
android:background="#767"
android:gravity="center"
android:text="Tab3"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toRightOf="@id/tab2"
app:layout_constraintRight_toRightOf="parent" />

6. Guideline 的使用
Guideline 放在哪都可以
<android.support.constraint.Guideline
android:id="@+id/guideline_h"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal" // vertical
app:layout_constraintGuide_percent="0.5" /> // 在 50% 的位置
// 其他屬性
layout_constraintGuide_begin
layout_constraintGuide_end
layout_constraintGuide_percent
參考
http://blog.csdn.net/lmj623565791/article/details/78011599
http://blog.csdn.net/guolin_blog/article/details/53122387