scrollTo(100, 100)的效果图如下:
若函数中参数为负值,则子View的移动方向将相反。
scrollBy(int x, int y)其实是对scrollTo的包装,移动的是相当位置。 scrollTo(int x, int y)的源码和scrollBy(int x, int y)源码如下所示.
[java] view plain copy
-
/**
-
* Move the scrolled position of your view. This will cause a call to
-
* {@link #onScrollChanged(int, int, int, int)} and the view will be
-
* invalidated.
-
* @param x the amount of pixels to scroll by horizontally
/**
-
* Set the scrolled position of your view. This will cause a call to
<