问题
In order to have list reordering functionality I turned to this implementation.
My problem is that when I try to drag an item in my ListView, I don't get the ACTION_DOWN event. Instead, for a single smear down motion I get 2 ACTION_MOVE events (action=0x00000002) and a single ACTION_UP event (action=0x00000001) in this order.
I've looked at similar questions but it seems like everyone has the opposite problem, getting only ACTION_DOWN events. Can anyone think of why this is happening?
Thanks, Yoel
回答1:
I was using the same code.
My problem was also that something was consuming the event and I didn't managed to found what was it... but i managed to solve it using onInterceptTouchEvent to return true on the events i needed on onTouchEvent.
Problem solved :-)
回答2:
It turns out I needed to add this small piece of code:
@Override
public boolean onInterceptTouchEvent(MotionEvent ev) {
return super.onInterceptTouchEvent(ev);
}
Now I get the ACTION_DOWN events in the OnTouchEvent function and it all works fine.
来源:https://stackoverflow.com/questions/9773855/android-listview-ontouchevent-doesnt-give-action-down