Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I faced with the same problem and found solution by intercepting touch event in RealViewSwitcher.</p> <p><strong>EDIT:</strong> previous posted variant does not work on newer API. There is third revision of code.</p> <p>Add those lines into RealViewSwitcher implementation:</p> <pre><code>@Override public boolean onInterceptTouchEvent(MotionEvent event) { // prevent vertical scrolling when view switching in progress if (!mScroller.isFinished()) return true; switch (event.getAction()) { case MotionEvent.ACTION_DOWN: mScrollLocked = false; mLastX = event.getX(); mLastY = event.getY(); mDeltaX = 0; mDeltaY = 0; onTouchEvent(event); break; case MotionEvent.ACTION_MOVE: final float x = event.getX(); final float y = event.getY(); mDeltaX += Math.abs(x - mLastX); mDeltaY += Math.abs(y - mLastY); mLastX = x; mLastY = y; if (mDeltaX &gt; mDeltaY) { mScrollLocked = true; onTouchEvent(event); } else { snapToDestination(); } break; } if (mScrollLocked) return true; // prevent furhter processing return super.onInterceptTouchEvent(event); } </code></pre> <p><strong>EDIT2:</strong> also need to edit <code>onTouchEvent</code> method and replace <code>case MotionEvent.ACTION_DOWN:</code> body as follows:</p> <pre><code> case MotionEvent.ACTION_DOWN: /* * If being flinged and user touches, stop the fling. isFinished will be false if being flinged. */ mTouchState = mScroller.isFinished() ? TOUCH_STATE_REST : TOUCH_STATE_SCROLLING; if (mTouchState == TOUCH_STATE_SCROLLING) { mScroller.abortAnimation(); } // Remember where the motion event started mLastMotionX = x; break; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload