question: @ CallSuper protected void onPageScrolled ( int position , float offset , int offsetPixels ) { if ( mDecorChildCount > 0 ) { final int scrollX = getScrollX ( ) ; int paddingLeft = getPaddingLeft ( ) ; int paddingRight = getPaddingRight ( ) ; final int width = getWidth ( ) ; final int childCount = getChildCount ( ) ; for ( int i = 0 ; i < childCount ; i ++ ) { final View child = getChildAt ( i ) ; final LayoutParams lp = ( LayoutParams ) child . getLayoutParams ( ) ; if ( ! lp . isDecor ) continue ; final int hgrav = lp . gravity & Gravity . HORIZONTAL_GRAVITY_MASK ; int childLeft = 0 ; switch ( hgrav ) { default : childLeft = paddingLeft ; break ; case Gravity . LEFT : childLeft = paddingLeft ; paddingLeft += child . getWidth ( ) ; break ; case Gravity . CENTER_HORIZONTAL : childLeft = Math . max ( ( width - child . getMeasuredWidth ( ) ) / 2 , paddingLeft ) ; break ; case Gravity . RIGHT : childLeft = width - paddingRight - child . getMeasuredWidth ( ) ; paddingRight += child . getMeasuredWidth ( ) ; break ; } childLeft += scrollX ; final int childOffset = childLeft - child . getLeft ( ) ; if ( childOffset != 0 ) { child . offsetLeftAndRight ( childOffset ) ; } } } dispatchOnPageScrolled ( position , offset , offsetPixels ) ; if ( mPageTransformer != null ) { final int scrollX = getScrollX ( ) ; final int childCount = getChildCount ( ) ; for ( int i = 0 ; i < childCount ; i ++ ) { final View child = getChildAt ( i ) ; final LayoutParams lp = ( LayoutParams ) child . getLayoutParams ( ) ; if ( lp . isDecor ) continue ; final float transformPos = ( float ) ( child . getLeft ( ) - scrollX ) / getClientWidth ( ) ; mPageTransformer . transformPage ( child , transformPos ) ; } } mCalledSuper = true ; }
target:  This method will be invoked when the current page is scrolled, either as part of a programmatically initiated smooth scroll or a user initiated touch scroll. If you override this method you must call through to the superclass implementation (e.g. super.onPageScrolled(position, offset, offsetPixels)) before onPageScrolled returns.