1

我有以下布局内容:

 <com.g2pdev.sudoku.ui.widget.NumbersView
        android:id="@+id/numbersView"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginStart="8dp"
        android:layout_marginTop="8dp"
        android:layout_marginEnd="8dp"
        app:layout_constraintTop_toBottomOf="@id/actionsLayout" />

    <View
        android:id="@+id/bannerContainerView"
        android:layout_width="match_parent"
        android:layout_height="@dimen/bannerAdContainerHeight"
        android:background="#ff0000"
        app:layout_constraintBottom_toBottomOf="parent" />

/>

在此处输入图像描述

红色视图是bannerContainerView,它有固定的高度。我担心它的'顶部会重叠'的情况numbersView,所以我想将它的'顶部边缘限制为numbersView'底部。可能吗?

PSconstraintTopToBottomOf在这里不起作用,因为如果有足够的空间,它将垂直居中视图。

4

1 回答 1

0

UpdateNumbersView的约束如下:

<com.g2pdev.sudoku.ui.widget.NumbersView
    android:id="@+id/numbersView"
    android:layout_width="match_parent"
    android:layout_height="0dp"
    android:layout_marginStart="8dp"
    android:layout_marginTop="8dp"
    android:layout_marginEnd="8dp"
    app:layout_constraintBottom_toTopOf="@+id/bannerContainerView"
    app:layout_constraintTop_toBottomOf="@id/actionsLayout" />
于 2019-12-26T20:36:49.940 回答