【发布时间】:2021-12-20 01:03:50
【问题描述】:
【问题讨论】:
-
这很容易通过 ConstraintLayout 完成。只需将
CardView中的top和bottom约束到background_image的底部
标签: android xml android-layout
【问题讨论】:
CardView 中的top 和bottom 约束到background_image 的底部
标签: android xml android-layout
请阅读how to write a good question first.
关于您的问题,这段代码可能会帮助您尝试使用负值 translationY
例如:
android:translationY="-50dp"
【讨论】:
据我说,重新排列布局、图像或文本视图的位置属于对齐主题。 所以如果你想把你的图片src垂直放在中间,你应该使用下面写的代码
android:layout_centerVertical="true"
水平居中
android:layout_centerHorizontal="true"
否则,我认为我们也可以使用重力将每个元素放在父布局的中间,例如android:gravity="center"
希望对您有所帮助。
【讨论】: