private void fling(int velocityY){
  if (getChildCount() > 0) {
    int scrollRange=getScrollRange();
    float topAmount=getCurrentOverScrollAmount(true);
    float bottomAmount=getCurrentOverScrollAmount(false);
    if (velocityY < 0 && topAmount > 0) {
      mOwnScrollY-=(int)topAmount;
      mDontReportNextOverScroll=true;
      setOverScrollAmount(0,true,false);
      mMaxOverScroll=Math.abs(velocityY) / 1000f * getRubberBandFactor(true) * mOverflingDistance + topAmount;
    }
 else     if (velocityY > 0 && bottomAmount > 0) {
      mOwnScrollY+=bottomAmount;
      setOverScrollAmount(0,false,false);
      mMaxOverScroll=Math.abs(velocityY) / 1000f * getRubberBandFactor(false) * mOverflingDistance + bottomAmount;
    }
 else {
      mMaxOverScroll=0.0f;
    }
    mScroller.fling(getScrollX(),mOwnScrollY,1,velocityY,0,0,0,Math.max(0,scrollRange),0,Integer.MAX_VALUE / 2);
    postInvalidateOnAnimation();
  }
}

private void fling ( int velocityY ) { if ( getChildCount ( ) > 0 ) { int scrollRange = getScrollRange ( ) ; float topAmount = getCurrentOverScrollAmount ( true ) ; float bottomAmount = getCurrentOverScrollAmount ( false ) ; if ( velocityY < 0 && topAmount > 0 ) { mOwnScrollY -= ( int ) topAmount ; mDontReportNextOverScroll = true ; setOverScrollAmount ( 0 , true , false ) ; mMaxOverScroll = Math . abs ( velocityY ) / 1000f * getRubberBandFactor ( true ) * mOverflingDistance + topAmount ; } else if ( velocityY > 0 && bottomAmount > 0 ) { mOwnScrollY += bottomAmount ; setOverScrollAmount ( 0 , false , false ) ; mMaxOverScroll = Math . abs ( velocityY ) / 1000f * getRubberBandFactor ( false ) * mOverflingDistance + bottomAmount ; } else { mMaxOverScroll = 0.0f ; } mScroller . fling ( getScrollX ( ) , mOwnScrollY , 1 , velocityY , 0 , 0 , 0 , Math . max ( 0 , scrollRange ) , 0 , Integer . MAX_VALUE / 2 ) ; postInvalidateOnAnimation ( ) ; } }
fling the scroll view
