Code example for OverScroller

Methods: abortAnimation, isFinished

0
 
    //Listener to handle all the touch events 
	private SimpleOnGestureListener mListener = new SimpleOnGestureListener() {
		public boolean onDown(MotionEvent e) { 
			//Cancel any current fling 
            if (!mScroller.isFinished()) { 
				mScroller.abortAnimation(); 
			} 
			return true; 
		} 
		 
		public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) { 
			//Call a helper method to start the scroller animation 
            fling((int)-velocityX/3, (int)-velocityY/3); 
			return true; 
		} 
		 
		public boolean onScroll(MotionEvent e1, MotionEvent e2, float distanceX, float distanceY) { 
			//Any view can be scrolled by simply calling its scrollBy() method 
			scrollBy((int)distanceX, (int)distanceY); 
			return true;