@@ -482,6 +482,10 @@ public boolean onInterceptTouchEvent(MotionEvent ev) {
482482 if (mScrollStrictSpan == null ) {
483483 mScrollStrictSpan = StrictMode .enterCriticalSpan ("ScrollView-scroll" );
484484 }
485+ final ViewParent parent = getParent ();
486+ if (parent != null ) {
487+ parent .requestDisallowInterceptTouchEvent (true );
488+ }
485489 }
486490 break ;
487491 }
@@ -546,10 +550,15 @@ public boolean onTouchEvent(MotionEvent ev) {
546550
547551 switch (action & MotionEvent .ACTION_MASK ) {
548552 case MotionEvent .ACTION_DOWN : {
549- mIsBeingDragged = getChildCount () != 0 ;
550- if (!mIsBeingDragged ) {
553+ if (getChildCount () == 0 ) {
551554 return false ;
552555 }
556+ if ((mIsBeingDragged = !mScroller .isFinished ())) {
557+ final ViewParent parent = getParent ();
558+ if (parent != null ) {
559+ parent .requestDisallowInterceptTouchEvent (true );
560+ }
561+ }
553562
554563 /*
555564 * If being flinged and user touches, stop the fling. isFinished
@@ -569,11 +578,23 @@ public boolean onTouchEvent(MotionEvent ev) {
569578 break ;
570579 }
571580 case MotionEvent .ACTION_MOVE :
581+ final int activePointerIndex = ev .findPointerIndex (mActivePointerId );
582+ final int y = (int ) ev .getY (activePointerIndex );
583+ int deltaY = mLastMotionY - y ;
584+ if (!mIsBeingDragged && Math .abs (deltaY ) > mTouchSlop ) {
585+ final ViewParent parent = getParent ();
586+ if (parent != null ) {
587+ parent .requestDisallowInterceptTouchEvent (true );
588+ }
589+ mIsBeingDragged = true ;
590+ if (deltaY > 0 ) {
591+ deltaY -= mTouchSlop ;
592+ } else {
593+ deltaY += mTouchSlop ;
594+ }
595+ }
572596 if (mIsBeingDragged ) {
573597 // Scroll to follow the motion event
574- final int activePointerIndex = ev .findPointerIndex (mActivePointerId );
575- final int y = (int ) ev .getY (activePointerIndex );
576- final int deltaY = mLastMotionY - y ;
577598 mLastMotionY = y ;
578599
579600 final int oldX = mScrollX ;
0 commit comments