I have onTouchListenerfor my LinearLayoutof ListView, and I am trying to use the data ACTION_DOWNand ACTION_UPto determine when the user has moved on to the next ListView. However, it is MotionEventnever equal ACTION_DOWN, although it ACTION_UPworks fine. After many searches, the only solution I could find is to return true when the event is fired, but I already did it. Here is my codeonTouchListener
View.OnTouchListener mTouchListener = new View.OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
if (event.getAction() == MotionEvent.ACTION_DOWN) {
downX = event.getX();
return true;
} else if (event.getAction() == MotionEvent.ACTION_UP) {
upX = event.getX();
if(userSwipedFarEnough)
doStuff()
return true;
}
return false;
}
};
source
share