I tried to understand how Android handle touch event and got a little bit confused. From what I understand touch event are send to the root view and pass down to the children.
I have a FrameLayout
that is a container for Fragment
.
First fragment view is a ScrollView
, second one is some kind of Gallery
(HorizontalListView) and the last one is also FrameLayout
. Only one fragment in the layout each time.
What I want to do is to identify user swipes on the screen, for the app use. I want to count the swipes and do something after some number of swipes.
I tried to put a OnTouchListener
on the top FrameLayout
but it doesn't get called when the child is the ScrollView
or the Gallery
. I tried to return false
and also true
in the end of onTouch
, but I get same result - it's never being called.
How can I do it? I just want to "transparently" handle the touch events and passing them on like I didn't even touch them.