List of usage examples for android.view View computeScroll
public void computeScroll()
From source file:ti.modules.titanium.ui.widget.TiUIScrollView.java
public void scrollTo(int x, int y, boolean smoothScroll) { // Fetch the scroll view. final View view = this.scrollView; if (view == null) { return;/*from ww w . j a v a 2 s . c o m*/ } // Convert the given coordinates to pixels. x = TiConvert.toTiDimension(x, -1).getAsPixels(view); y = TiConvert.toTiDimension(y, -1).getAsPixels(view); // Disable smooth scrolling for vertical scroll views if not at top of view. // Note: This works-around a bug in Google's NestedScrollView where attempting to // smooth scrolls will move to a totally different position or opposite directions. if (smoothScroll && (view instanceof TiVerticalScrollView)) { if (((TiVerticalScrollView) view).getScrollY() > 0) { smoothScroll = false; } } // Scroll to the given position. if (smoothScroll) { if (view instanceof TiHorizontalScrollView) { ((TiHorizontalScrollView) view).smoothScrollTo(x, y); } else if (view instanceof TiVerticalScrollView) { ((TiVerticalScrollView) view).smoothScrollTo(x, y); } } else { view.scrollTo(x, y); } view.computeScroll(); }