public void snapToClosestIndex(OverScroller scroller,int duration){
  if (xStops.stops.length == 0) {
    computeXAxis();
  }
  float closestX=Float.MAX_VALUE;
  float centerX=contentRect.centerX();
  for (int i=0; i < xStops.stops.length; i++) {
    float x=getDrawX(xStops.stops[i]);
    if (Math.abs(x - centerX) <= Math.abs(closestX - centerX)) {
      closestX=x;
    }
  }
  scrollXTo(scroller,closestX,duration);
}

public void snapToClosestIndex ( OverScroller scroller , int duration ) { if ( xStops . stops . length == 0 ) { computeXAxis ( ) ; } float closestX = Float . MAX_VALUE ; float centerX = contentRect . centerX ( ) ; for ( int i = 0 ; i < xStops . stops . length ; i ++ ) { float x = getDrawX ( xStops . stops [ i ] ) ; if ( Math . abs ( x - centerX ) <= Math . abs ( closestX - centerX ) ) { closestX = x ; } } scrollXTo ( scroller , closestX , duration ) ; }
snap to closest x index
