0

In a ScrollView, I want to implement horizontal scrolling. To do so, I listen to the MotionEvents sent when fingers touch the screen or move onto it. It works pretty well, except when I unwillingly combine a vertical move with the horizontal one. I noticed that the vertical move interrupts the string of ACTION_MOVE by placing an ACTION_CANCEL event. And after it, no more ACTION_MOVE events are generated.

How can I do to prevent those vertical moves from cancelling the emission of ACTION_MOVE events?

Thanks in advance for the time you will spend trying to help me.

4

2 回答 2

1

您希望垂直内的子视图Scrollview调用这行代码:

getParent().requestDisallowInterceptTouchEvent(true);

查看此 SO 帖子以获取更多信息:如果孩子返回 false,则让父视图假设 MotionEvents

于 2012-07-15T06:28:38.277 回答
0

你为什么不直接使用Horizo​​ntalScrollView 这就是这些东西的目的。

于 2012-07-15T06:27:32.743 回答