[英]How to position view based on position of one of sibling ViewGroup's child?
Ok, the question may sound confusing. 好的,这个问题听起来令人困惑。 Let me explain the scenario:
让我解释一下这种情况:
Refer the image at following link, (-I wasn't able to use imgur as it is blocked in my network): http://www.flickr.com/photos/93397745@N05/8494742266/ 请参阅以下链接中的图像,(-我无法使用imgur,因为它已在我的网络中被阻止): http ://www.flickr.com/photos/93397745@N05/8494742266/
There, I hope I have the view explained. 在那里,我希望我的观点得到解释。 Now what I need is that the green 1px line should move horizontally so as to stay aligned below IndicatorView whenever horizontal scrolling is done.
现在,我需要的是绿色的1px线应水平移动,以便在完成水平滚动时始终保持在IndicatorView下方。 I've currently implemented it as follows:
我目前已按以下方式实施:
This works fine most of the time. 在大多数情况下,这都可以正常工作。 But sometimes, when I do left-right-left-right scroll continuously, the 1pxLine does not stay in sync with the scrolling IndicatorView (--However, once scrolling stops, it comes back into sync!) So what changes do I need to make so that the line stays in sync even during scroll operations?
但是有时候,当我连续左右滚动时,1pxLine不会与滚动的IndicatorView保持同步(但是,一旦停止滚动,它就会恢复同步!)所以我需要做些什么更改使行即使在滚动操作期间也保持同步?
Please let me know if someone has been able to do this before. 请让我知道之前是否有人可以这样做。
Thanks, 谢谢,
-Kiran -基兰
I'd take the IndicatorView
out of ViewTopBar
, and together with 1px-line-view I'd include it within some container layout, which I'd put inside CustomView
instead. 我
ViewTopBar
IndicatorView
取出ViewTopBar
,并与1px-line-view一起将其包含在某些容器布局中,该容器布局应放在CustomView
。 That way, you could control position of this element as a whole, instead of making one 'catching-up' with another. 这样,您可以控制整个元素的位置,而不必与另一个元素“追赶”。 Not sure if it's applicable in your case though.
但是不确定是否适用于您的情况。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.