Abd*_*jaz 4 android margins android-constraintlayout
首先看看我的观点的布局
这是 XML
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/mainCL"
android:layout_width="match_parent"
android:layout_height="0dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintTop_toBottomOf="@id/appBarLayout"
>
<TextView
android:id="@+id/bankInfoHeadingTV"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="36dp"
android:layout_marginTop="40dp"
android:layout_marginEnd="8dp"
android:fontFamily="@font/montserrat_semibold"
android:text="Bank Information"
android:textColor="@color/black"
android:textSize="16sp"
android:textStyle="bold"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<ImageView
android:id="@+id/bankInfoIconIV"
android:layout_width="42dp"
android:layout_height="32dp"
android:src="@drawable/card"
app:layout_constraintBottom_toBottomOf="@id/bankInfoHeadingTV"
app:layout_constraintStart_toEndOf="@id/bankInfoHeadingTV"
app:layout_constraintTop_toTopOf="@id/bankInfoHeadingTV" />
</androidx.constraintlayout.widget.ConstraintLayout>
Run Code Online (Sandbox Code Playgroud)
我想在bankInfoHeadingTV和bankInfoIconIV之间放置一些空格。因此它在bankInfoHeadingTV
的末尾放置了30dp的边距,但它不起作用。以bankInfoIconIV
开始的保证金工作正常,但为什么以bankInfoHeadingTV结束的保证金不工作?
小智 5
如果有限制,您只能设置视图的边距。因为您将 ImageView 的开始限制为 textView 的末尾,所以您可以设置图像的开始边距。如果您反转它并将 TextView 的末端限制到 ImageView,则可以在 TextView 中设置边距。
| 归档时间: |
|
| 查看次数: |
2397 次 |
| 最近记录: |