Code example for OverScroller

Methods: fling

0
		if (mScrollRange == 0) {
			return; 
		} 
 
		final int halfWidth = (getWidth() - getPaddingLeft() - getPaddingRight()) / 2;
		mScroller.fling(getScrollX(), 0, velocity, 0, 0, mScrollRange, 0, 0, halfWidth, 0);
		invalidate();
	} 
 
	/** 
	 * Perform one-time initialization 
	 *  
	 * @param context Context to load Resources and ViewConfiguration data 
	 */ 
	private void init(Context context) {
		final Resources res = context.getResources();
		mIconSize = res.getDimensionPixelSize(R.dimen.icon_size);
		mIconSpacing = res.getDimensionPixelSize(R.dimen.icon_spacing);
 
		// Cache ViewConfiguration values 
		final ViewConfiguration config = ViewConfiguration.get(context);