Suppose I have a parent view (for example a LinearLayout
) which accommodate some child view(for example Button
) that occupy whole space of their parent space, What I want is I want to detect swipe event on the parent. For this purpose I choose Touch event for the parent, But when I touch the parent(that is full of children) the onTouch
handler does not trigger at all. I think this is because of its children.
Can anyone please point me out how can I achieve my purpose ? Thanks
Asked
Active
Viewed 939 times
0

frogatto
- 28,539
- 11
- 83
- 129
-
Possible duplicate of http://stackoverflow.com/questions/4139288/android-how-to-handle-right-to-left-swipe-gestures – Triode Jan 28 '14 at 08:55
2 Answers
2
Override the onInterceptTouchEvent() method of the parent view and let it return true. You can refer to this for more information

Lingkun Kong
- 346
- 2
- 6
0
Set touchfocus of child view false. Then parent view Touch event calls.
android:focusable="false"
android:focusableInTouchMode="false"

Gaurav Berry
- 131
- 9