I would like to implement drag-n-drop feature for Android 2.2. I override onTouchListener for each my control. But all my controls are inside ScrollView. When all my controls are visible on in ScrollView, then dra-n-drop works fine. But when not all controls are visible on screnn and scrolling appears, I can't use dra-n-drop. All events come to ScrollView and only scrollview proceed them. Contols didn't get touch events and as result, I can't drag my controls. Does anybody know how to resolve this issue? I suppose, that scrollview should proceed self touch event, but then it should transfer this touch event to the children controls. How can I do it? Or any other solutions?
Asked
Active
Viewed 1.9k times
2 Answers
23
Use mScrollView.requestDisallowInterceptTouchEvent(true);
to avoid ScrollView to handle touchEvents. Also as Ridcully pointed out handle the touch event in onInterceptTouchEvent()
.

Dayerman
- 3,973
- 6
- 38
- 54
-
2Thanks a lot! `mScrollView.requestDisallowInterceptTouchEvent(true);` resolved my issue. I didn't want to implement custom scrollview. I was sure that it's possible to do it without custom view. And your solution really helps me. But I need to call this method and set to true each time when I process touch event of my control. – brave_warrior Sep 30 '12 at 21:20
0
Have a look at the onInterceptTouchEvent() method. You'll have to sub-class ScrollView and override and tweak this method.

Ridcully
- 23,362
- 7
- 71
- 86