我無法實現這個。 我想讓viewB跟隨viewA的開始。 然後,我想創建一個約束,從viewA的開始到它的父節點有一個空間。Android設置約束讓view2跟隨視圖1的開始。但是view1對其父項的開始有約束
代碼我想:
<android.support.constraint.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp">
<TextView
android:id="@+id/descriptionTxt"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginEnd="32dp"
android:layout_marginStart="8dp"
android:text="Txt1"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/descriptionTxt2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:text="Txt2"
app:layout_constraintEnd_toEndOf="@+id/descriptionTxt"
app:layout_constraintStart_toStartOf="@+id/descriptionTxt"
app:layout_constraintTop_toBottomOf="@+id/descriptionTxt" />
</android.support.constraint.ConstraintLayout>
上面的代碼將在預覽顯示,僅viewA會從左邊的餘量。 viewB不遵循viewA的左側。
進出口使用com.android.support.constraint:約束的佈局:1.0.2
感謝您的解釋。現在我明白了 – iori24