/** * 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. */ protected void onPageScrolled() { final int scrollX = getScrollX(); final int childCount = getChildCount(); for (int i = 0; i < childCount; i++) { final View child = getChildAt(i); final float transformPos = (float) (child.getLeft() - scrollX) / getClientWidth(); transformPage(child, transformPos); } }