大而长的图像以不同的速度在屏幕上滚动,并超出屏幕左侧

发布于 2024-12-10 16:59:36 字数 394 浏览 1 评论 0原文

所以我有多个很长的图像(例如 2000x100),我希望它们以不同的速度在屏幕上滚动。我原来的解决方案不起作用。最初,我将它们全部放在 Horizo​​ntalScrollView 中,并制作了一个可运行的文件,使用 setPadding 来调整 ImageView 在滚动视图中的位置。然而,这是有效的,背景应该在屏幕上保持大部分静止,当您滚动时来回摇动,并且明显滞后于滚动位置。它断断续续,看起来很糟糕。

有没有其他方法可以在屏幕上移动图像以达到所需的效果?

(我可以使用框架布局,并设置一个 ontouchlistener 吗?那么如何在屏幕上移动布局?)

我设置了一个布局,以便图像正确地从屏幕右侧突出,但我不能似乎将它们移离屏幕左侧(setpadding(-50,0,0,0)不起作用)

提前致谢!

So I have multiple very long images (like 2000x100) that i want to have scrolling across the screen at different speeds. and my original solution is not working out. Originally, I placed them all in a HorizontalScrollView, and made a runnable that used setPadding to adjust the position of the ImageViews within the scrollView. This works, however, the background that is supposed to remain mostly stationary on the screen, shakes back and forth as you scroll, and lags behind the scroll location significantly. It's choppy and it looks bad.

Is there any other way that I can move images across the screen to achieve the desired effect?

(could I perhaps use a frame layout, and set an ontouchlistener? then how would you move the layout across the screen?)

I set up a layout so that the images protrude off of the right of the screen correctly, but I can't seem to move them off of the left of the screen (setpadding(-50,0,0,0) does not work)

Thanks in advance!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

季末如歌 2024-12-17 16:59:36

我通过在框架布局中使用相对布局解决了这个问题。我为框架布局设置了一个 ontouchlistener,并为每个图像使用了带有修改系数的scrollTo 方法。我以前没有注意到布局的scrollTo 和scrollBy 方法。

I solved this by using relative layouts within a frame layout. I set an ontouchlistener for the frame layout and used the scrollTo method for each image with a modifying coefficient. I had not previously noticed the scrollTo and scrollBy methods of the layout.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文