Code example for ViewPager.OnPageChangeListener

Methods: getPaddingLeft

0
 
	void updatePositions(int positionOffsetPixels){
		int textWidth = mCurrent.getWidth() - mCurrent.getPaddingLeft() - mCurrent.getPaddingRight();
		int maxOffset = this.getWidth() / 2 - textWidth / 2 - mArrowPadding;
		if(positionOffsetPixels > 0){
			maxOffset -= this.getPaddingLeft();
			int offset = Math.min(positionOffsetPixels, maxOffset - 1);
			mCurrent.setPadding(0, 0, 2 * offset, 0);
		}else{ 
			maxOffset -= this.getPaddingRight();
			int offset = Math.max(positionOffsetPixels, -maxOffset);
			mCurrent.setPadding(-2 * offset, 0, 0, 0);
		} 
	} 
 
	/** 
	 * Hide arrows if we can't scroll further 
	 *  
	 * @param position 
	 */ 
Contextual code suggestions in your IDE  Get Codota for Java