7

ths sdk said:

3、For as long as you return false from this function, each following event (up to and including the final up) will be delivered first here and then to the target's onTouchEvent().

4、If you return true from here, you will not receive any following events: the target view will receive the same event but with the action ACTION_CANCEL, and all further events will be delivered to your onTouchEvent() method and no longer appear here.

But when i use this method,no matter what onInterceptTouchEvent() returns ,it does the same work! And never did MotionEvent.ACTION_MOVE or MotionEvent.ACTION_UP been captured by this method. Can anybody help me figure it out?

ths!

Community
  • 1
  • 1

2 Answers2

4

Normally the touch goes from most upper view to the lowest through onInterceptTouchEvent and then it goes back via onTouchEvent.

If you return true in onInterceptTouchEvent you forbid it to continue and the view where you returned true is the last one to receive the touch, you consume it

You can also disallow your parent view to consume the event by requestDisallowInterceptTouchEvent(true);

animuson
  • 53,861
  • 28
  • 137
  • 147
Lukas Hanacek
  • 1,364
  • 14
  • 25
0

When none of the children of your view return true in onTouchEvent, onInterceptTouchEvent will ONLY be called for MotionEvent.ACTION_DOWN.

Here is a complete description of the MotionEvent processing.

Community
  • 1
  • 1
Marcel Wolterbeek
  • 3,367
  • 36
  • 48