Skip to content

Instantly share code, notes, and snippets.

@Dmuasya
Created December 22, 2020 17:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Dmuasya/62b4350ac6cf163a26061ccf557da38f to your computer and use it in GitHub Desktop.
Save Dmuasya/62b4350ac6cf163a26061ccf557da38f to your computer and use it in GitHub Desktop.
@Override
public boolean onInterceptTouchEvent(MotionEvent ev)
{
int action = ev.getAction();
float y = ev.getY();
switch (action)
{
case MotionEvent.ACTION_DOWN:
mLastY = y;
break;
case MotionEvent.ACTION_MOVE:
float dy = y - mLastY;
getCurrentScrollView();
if (Math.abs(dy) > mTouchSlop)
{
mDragging = true;
if (!isTopHidden
|| (mInnerScrollView.getScrollY() == 0 && isTopHidden && dy > 0))
{
return true;
}
}
break;
}
return super.onInterceptTouchEvent(ev);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment