ConstraintLayout-垂直限制视图的顶部

问题描述 投票:0回答: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" />

/>

enter image description here

红色视图是bannerContainerView,其高度固定。恐怕会出现其顶部重叠numbersView的情况,因此我想将其顶部边缘限制为numbersView的底部。有可能吗?

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

android android-layout android-constraintlayout
1个回答
0
投票

更新NumbersView的约束,如下所示:

© www.soinside.com 2019 - 2024. All rights reserved.