当有人在 ScrollView 上水平移动手指时如何捕获事件?
我在整个屏幕上都有 ScroolView,垂直滚动效果很好。当有人在 ScrollView 上水平移动手指时如何捕获事件?当用户水平和垂直移动手指以保持原样时,我需要做一些数学计算。
I have ScroolView over whole screen and vertical scroll works fine. How to catch event when somebody move finger horizontally over ScrollView ? I need to do some math when user move finger horizontally and vertically to stay as it is .
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以通过在 ScrollView 的 setOnTouchListner() 方法中使用 GestureDetector 类来实现此目的。
GestureDetector 将为您提供不同手势的回调方法。您可以实现 onFling 方法以使其识别向左或向右滑动。
此链接可能会有所帮助。
我希望这会有所帮助...
You can do so by using a GestureDetector class in the ScrollView's setOnTouchListner() method.
The GestureDetector will give you callback methods for different gestures. You can implement the onFling method to make it recognize left or right flick.
This link might be helpful.
I hope this will help...