Does onInterceptTouchEvent() really works as the sdk said?
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!
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 onInterceptTouchEven
t 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);
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.
链接地址: http://www.djcxy.com/p/53322.html上一篇: C ++读取txt的随机行吗?