I have LinearLayout that has 1) Views on it and 2) has a Gesture detector. My problem is that when I want to do a fling gesture on the linear layout, if my finger comes across any of the views, it will throw a MotionEvent.ACTION_CANCEL which will prevent the onFling() callback firing.
I can’t really disable touch on those foreground views because they are part of a navigation to launch Intents.
Thx,
-mL
Try to take a look inside of ViewPager how it does.
http://grepcode.com/file/repository.grepcode.com/java/ext/com.google.android/android/4.0.3_r1/android/support/v4/view/ViewPager.java#ViewPager.onInterceptTouchEvent%28android.view.MotionEvent%29
You need to create your LinearLayout (by simply extending Android’s LinearLayout) and override onInterceptTouchEvent. This is called before child and if it returns true parent steals touch from children.
http://developer.android.com/reference/android/view/ViewGroup.html#onInterceptTouchEvent(android.view.MotionEvent)