我无法实现这个。 我想让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