MotionEvent.ACTION_DOWN is not called, although I believe for it

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;

        }

    };
+4
source share
2 answers

I realized what was going on, scrollview for my list is somehow to steal action_down, so it wasnโ€™t called. I realized this when I had an empty list and the scrolling worked.

+3

OnTouch ACTION_DOWN ACTION_UP ACTION_MOVE, . , else, if,

0

All Articles