protected void onPageScrolled(int position,float offset,int offsetPixels){
  if (mDecorChildCount > 0) {
    final int scrollY=getScrollY();
    int paddingTop=getPaddingTop();
    int paddingBottom=getPaddingBottom();
    final int height=getHeight();
    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 vgrav=lp.gravity & Gravity.VERTICAL_GRAVITY_MASK;
      int childTop=0;
switch (vgrav) {
default :
        childTop=paddingTop;
      break;
case Gravity.TOP:
    childTop=paddingTop;
  paddingTop+=child.getHeight();
break;
case Gravity.CENTER_VERTICAL:
childTop=Math.max((height - child.getMeasuredHeight()) / 2,paddingTop);
break;
case Gravity.BOTTOM:
childTop=height - paddingBottom - child.getMeasuredHeight();
paddingBottom+=child.getMeasuredHeight();
break;
}
childTop+=scrollY;
final int childOffset=childTop - child.getTop();
if (childOffset != 0) {
child.offsetTopAndBottom(childOffset);
}
}
}
if (mOnPageChangeListener != null) {
mOnPageChangeListener.onPageScrolled(position,offset,offsetPixels);
}
if (mInternalPageChangeListener != null) {
mInternalPageChangeListener.onPageScrolled(position,offset,offsetPixels);
}
if (mPageTransformer != null) {
final int scrollY=getScrollY();
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.getTop() - scrollY) / getClientHeight();
mPageTransformer.transformPage(child,transformPos);
}
}
mCalledSuper=true;
}

protected void onPageScrolled ( int position , float offset , int offsetPixels ) { if ( mDecorChildCount > 0 ) { final int scrollY = getScrollY ( ) ; int paddingTop = getPaddingTop ( ) ; int paddingBottom = getPaddingBottom ( ) ; final int height = getHeight ( ) ; 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 vgrav = lp . gravity & Gravity . VERTICAL_GRAVITY_MASK ; int childTop = 0 ; switch ( vgrav ) { default : childTop = paddingTop ; break ; case Gravity . TOP : childTop = paddingTop ; paddingTop += child . getHeight ( ) ; break ; case Gravity . CENTER_VERTICAL : childTop = Math . max ( ( height - child . getMeasuredHeight ( ) ) / 2 , paddingTop ) ; break ; case Gravity . BOTTOM : childTop = height - paddingBottom - child . getMeasuredHeight ( ) ; paddingBottom += child . getMeasuredHeight ( ) ; break ; } childTop += scrollY ; final int childOffset = childTop - child . getTop ( ) ; if ( childOffset != 0 ) { child . offsetTopAndBottom ( childOffset ) ; } } } if ( mOnPageChangeListener != null ) { mOnPageChangeListener . onPageScrolled ( position , offset , offsetPixels ) ; } if ( mInternalPageChangeListener != null ) { mInternalPageChangeListener . onPageScrolled ( position , offset , offsetPixels ) ; } if ( mPageTransformer != null ) { final int scrollY = getScrollY ( ) ; 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 . getTop ( ) - scrollY ) / getClientHeight ( ) ; mPageTransformer . transformPage ( child , transformPos ) ; } } mCalledSuper = true ; }
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 .
