Code example for ViewPager.OnPageChangeListener

Methods: getWidth

0
	// 244, 245, 0, 1, 2 
	// New: 
	// -2, -1, 0, 1, 2 
	int adjustOffset(int positionOffsetPixels) {
		// Move offset half width 
		positionOffsetPixels += this.getWidth() / 2;
		// Clamp to width 
		positionOffsetPixels %= this.getWidth();
		// Center around zero 
		positionOffsetPixels -= this.getWidth() / 2;
		return positionOffsetPixels;
	} 
 
	@Override 
	public void onPageSelected(int position) {
		// Reset padding when the page is finally selected (May not be 
		// necessary) 
		mCurrent.setPadding(0, 0, 0, 0);
		imm.hideSoftInputFromWindow(this.getApplicationWindowToken(), 0);
	}