0
如何将View
置于另一个View
的ConstraintLayout
?基本上我想实现这一点:在约束层布局中的另一个视图下放置视图
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<View
android:id="@+id/view1"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<View
android:id="@+id/view2"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
在厂景是在Z轴视图2。
添加'app:layout_constraintTop_toBottomOf =“@ + id/view1”'将在视图的顶部和底部之间创建约束,并且不会将它们放在彼此之上。这不是我试图实现的目标 – ben
当你说他们把它们放在另一个上面时,你的意思是你想让view1垂直地位于视图2之上,还是字面上方,因为它们重叠? @ben –
我看到,也许你希望它们互相重叠,我会相应地更新代码。 –