Let's say I have a ListView, and one row in it is a custom View of mine. The开发者_开发百科 user touches inside the custom view -> custom View gets to handle this touch event. User continues this touch sequence inside the are of the custom View -> custom View gets to handle those events too.
Problem: When the user drags his/her finger outside the area of the custom View (the drag started inside), the custom View losts the touch events. But I need those events too, how can I achieve this?
I know that this can be done: if you put a Gallery containing a bunch of images inside a LisView, and I start to drag the Gallery left-right, and drag my finger outside the area of the Gallery while doing so (moving up/downwards too much), I still control the Gallery scrolling, not the ListView.
I hope that I was clear enough, does anyone have some tips on this problem?
According to this post by Dianne Hackborn, if you return true to a down event in a view's onTouchEvent()
, following events are sent automatically to that view.
To get all following events I also had to call view.getParent().requestDisallowInterceptTouchEvent(true) in my onTouch Listener.
精彩评论