有没有一种方法可以使分隔线与另一个视图对齐,但使其比另一个视图“更长”?

时间:2019-02-07 13:44:28

标签: android xml divider android-constraintlayout

我正在尝试通过XML将两个分隔符添加到应用程序中。 我已经用一些按钮对齐了分隔线。

我想避免与父级分隔符,然后在分隔符的每一侧添加边距。

是否有可能使分隔线与按钮对齐,并使每个分隔线(垂直和水平)的两端的分隔线更长(红色标记)

有可能吗?

https://imgur.com/a/lteFM2K

我尝试添加负边距,但这没有用(声音可能非常愚蠢)。

<View
    android:id="@+id/view"
    android:layout_width="1dp"
    android:layout_height="0dp"
    android:layout_marginTop="8dp"
    android:background="#000000"
    android:visibility="visible"
    app:layout_constraintBottom_toBottomOf="@+id/button_onePointTeamb"
    app:layout_constraintEnd_toEndOf="parent"
    app:layout_constraintStart_toStartOf="parent"
    app:layout_constraintTop_toTopOf="@+id/textView_teamb" />

<View
    android:id="@+id/view2"
    android:layout_width="0dp"
    android:layout_height="1dp"
    android:layout_marginStart="8dp"
    android:layout_marginLeft="8dp"
    android:layout_marginTop="8dp"
    android:layout_marginEnd="8dp"
    android:layout_marginRight="8dp"
    android:layout_marginBottom="8dp"
    android:background="#000000"
    android:visibility="visible"
    app:layout_constraintBottom_toTopOf="@+id/textView_scoreTeama"
    app:layout_constraintEnd_toEndOf="@+id/button_threePointsTeamb"
    app:layout_constraintStart_toStartOf="@+id/button_threePointsTeama"
    app:layout_constraintTop_toBottomOf="@+id/textView_teama" />

有可能这样做吗?

0 个答案:

没有答案