Thus, in the case of overlapping views, touch events are sent from the uppermost child to one at the back, then another after the second child, and so on. However, if the uppermost child was to use a touch event (i.e., Process it when it is received), then the views under this view will not receive touch events.
If onTouchEvent returns true, it tells the view manager that it handled the touch and does not want the event to be dispatched to other views. If you want the view under this view to also get a touch, you want to return "false" from onTouchEvent for the first view, in your case "Innerview".
Also, in your code, I noticed that you programmatically send touch events to 2 views from the container class. This causes InnerView to get a touch even when OuterView is ONLY used. If you want this functionality, then everything is in order. If you want InnerView to receive events only when it has been touched, you do not want the container class to call onTouchEvent explicitly in these two views. The hierarchy of views will do this for you.
About getting onFling or onSingleTapConfirmed on BOTH views - (if you want touch events to go to views, and also, you return "false" from onTouchEvent for InnerView), InnerView already passed the event a look behind it, so it does not reach the end gestures to understand what just happened, and similarly for onSingleTapConfirmed. If you want to receive them, you may have to automatically send touch events at the end of gestures, as OuterView has detected. Meaning, if OuterView received fling gestures, then this was also for InnerView, and therefore programmatically make this gesture for InnerView. This is quite complicated, and dispatching calls back in the hierarchy is not an ordinary thing.
I hope I didn’t confuse you. Feel free to ask if I’m clear, and I will try again.
This will be useful: Handling TouchEvents in a ViewGroup
mistwalker
source share