简体   繁体   English

如何在RelativeLayout中约束一个视图使其与另一个视图重叠

[英]How to constraint a view to overlap another view in RelativeLayout

I am overlapping an ImageView on top of a View in a RelativeLayout. 我在RelativeLayout的View顶部重叠了ImageView。

something like this: 像这样的东西:

在此处输入图片说明 1 1

Where the middle white circle(ImageView) is overlapping the white vertical border(View). 中间的白色圆圈(ImageView)与白色垂直边框(View)重叠的位置。

But for some reason I am not managing to constraint the circle above the z position of the white border. 但是由于某种原因,我无法将圆限制在白色边框的z位置上方。 and if the border moves say to the right side of the screen, I want the circle to move there too. 如果边框移动到屏幕的右侧,我也希望圆也移动到屏幕的右侧。 but instead the circle always remains in the center regardless to the position of the border. 但无论边框的位置如何,圆圈始终保持在中心。 How do I this in a RelativeLayout? 我该如何在RelativeLayout中使用?

TIA TIA

You can make like: 您可以像这样:
AlignLeftOf the border AlignLeft的边界

Then code: circle.translationX( circle_width/2) 然后代码:circle.translationX(circle_width / 2)
(and a bit of justification, it should be good) (还有一点道理,应该很好)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM