views:

39

answers:

1

I have a custom Android view which overrides onTouchEvent(MotionEvent) to handle horizontal scrolling of content within the view. However, when the ScrollView in which this is contained scrolls vertically, the custom view stops receiving touch events. Ideally what I want is for the custom view to continue receiving events so it can handle its own horizontal scrolling, while the containing view hierarchy deals with vertical scrolling.

Is there any way to continue receiving those motion events on scroll? If not, is there any other way to get the touch events I need?

A: 

I'm answering my own question in case anyone else is as bad at Googling for the answer as I apparently was. :P

A workaround for this problem is to extend ScrollView and override the onInterceptTouchEvent method so that it only intercepts touch events where the Y movement is significant (greater than the X movement, according to one suggestion).

Adrian