Code example for ViewPager

Methods: getMeasuredHeight, getMeasuredWidth

0
 
	protected void animateScroll(int position, float positionOffset) {
		if (mState != State.IDLE) {
			mRot = (float)(1-Math.cos(2*Math.PI*positionOffset))/2*30.0f;
			ViewHelper.setRotationY(this, mState == State.GOING_RIGHT ? mRot : -mRot);
			ViewHelper.setPivotX(this, getMeasuredWidth()*0.5f);
			ViewHelper.setPivotY(this, getMeasuredHeight()*0.5f);
		} 
	} 
 
	protected void animateTablet(View left, View right, float positionOffset) {		
		if (mState != State.IDLE) {
			if (left != null) {
				manageLayer(left, true);
				mRot = 30.0f * positionOffset;
				mTrans = getOffsetXForRotation(mRot, left.getMeasuredWidth(),
						left.getMeasuredHeight());
				ViewHelper.setPivotX(left, left.getMeasuredWidth()/2);
				ViewHelper.setPivotY(left, left.getMeasuredHeight()/2);
				ViewHelper.setTranslationX(left, mTrans);
				ViewHelper.setRotationY(left, mRot);