是否可以根据屏幕上其他位置捕获的触摸事件手动滚动图库
在我的 Android 应用程序中,我有一个包含一些 TextView 的图库。我意识到有些用户不明白他们可以滚动该图库,尽管上一个和下一个 TextView 部分可见。所以我在画廊下面放了一个带有水平箭头的ImageView。 现在用户尝试拖动箭头。是否可以将触摸事件从 ImageView 重定向到图库,以便拖动它可以滚动图库?
提前致谢, 周五
In my Android app I have a gallery which contains some TextViews. I realized that some users don't understand that they can scroll that gallery although the previous and next TextViews are partially visible. So I put an ImageView with a horizontal arrow under the gallery.
Now the users try to drag the arrow. Is it possible to redirect the touch event from the ImageView to the gallery so that dragging it would scroll the gallery?
Thanks in advance,
Fri
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
最简单的事情(如果您不介意一次滚动一个项目)是检测箭头上触摸事件的方向,然后在图库上调度SetSelected(boolean selected)...我相信这会起作用。用户执行此操作一次后,他们可能会直觉地认为他们可以直接拖动图库。当然,如果您想测量触摸事件速度并根据该速度计算滚动距离,您也可以这样做......但这似乎有很多不必要的麻烦。
The simplest thing (if you don't mind scrolling one item at a time) is to detect the direction of the touch event on the arrow and then dispatchSetSelected(boolean selected) on the gallery... I believe that will work. after the user does that once, they will probably intuit that they can then just drag the gallery. Of course if you want to measure the touch event speed and do the calculation for how far to scroll based on that, you can do that too... but that seems like a lot of unnecessary trouble.