Search code examples
androidgallerylistenerscrollviewmultiple-views

Android - Mulitple listeners on a single view with the ability to pass off events to other views


I have a Gallery that contains a ScrollView. I can scroll through the text in the ScrollView with a vertical swipe as is standard. However, I would like the ScrollView to also listen for horizontal swipes which would then move the Gallery left or right. Does anyone know how to do that?

Thanks.


Solution

  • Okay, here is what I found. You will need to use onInterceptTouchEvent(). You can read about it here: http://developer.android.com/reference/android/view/ViewGroup.html

    Alternatively, you can do a search for onInterceptTouchEvent example to find several examples.