Skip to content

Instantly share code, notes, and snippets.

@XjojoX1989
Created April 4, 2020 08:37
Show Gist options
  • Save XjojoX1989/ab671d1a052ad09c9704cb0975a50407 to your computer and use it in GitHub Desktop.
Save XjojoX1989/ab671d1a052ad09c9704cb0975a50407 to your computer and use it in GitHub Desktop.
public void scrollTo(int x,int y) {
if (mScrollX != x || mScrollY != y) {
int oldX = mScrollX;
int oldY = mScrollY;
mScrollX = x;
mScrollY = y;
invalidateParentCaches();
onScrollChanged(mScrollX,mScrollY,oldX,oldY);
if (!awakenScrollBars()) {
postInvalidateOnAnimation();
}
}
}
public void scrollBy(int x,int y) {
scrollTo(mScrollX + x,mScrollY + y);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment