Code example for Transformation

Methods: clear, getMatrix, setTransformationType

0
	 */ 
	private int getCenterOfCoverflow() { 
		return (getWidth() - getPaddingLeft() - getPaddingRight()) / 2
				+ getPaddingLeft();
	} 
 
	/** 
	 * Get the Centre of the View 
	 *  
	 * @return The centre of the given view. 
	 */ 
	private static int getCenterOfView(View view) {
		return view.getLeft() + view.getWidth() / 2;
	} 
 
	/** 
	 * {@inheritDoc} 
	 *  
	 * @see #setStaticTransformationsEnabled(boolean) 
	 */ 
	protected boolean getChildStaticTransformation(View child, Transformation t) {
 
		final int childCenter = getCenterOfView(child);
		final int childWidth = child.getWidth();
		int rotationAngle = 0;
 
		t.clear();
		t.setTransformationType(Transformation.TYPE_MATRIX);
 
		if (childCenter == mCoveflowCenter) {
			transformImageBitmap((ImageView) child, t, 0);
		} else { 
			rotationAngle = (int) (((float) (mCoveflowCenter - childCenter) / childWidth) * mMaxRotationAngle);
			if (Math.abs(rotationAngle) > mMaxRotationAngle) {
				rotationAngle = (rotationAngle < 0) ? -mMaxRotationAngle
						: mMaxRotationAngle;
			} 
			transformImageBitmap((ImageView) child, t, rotationAngle);
		} 
 
		return true; 
	} 
 
	/** 
	 * This is called during layout when the size of this view has changed. If 
	 * you were just added to the view hierarchy, you're called with the old 
	 * values of 0. 
	 *  
	 * @param w 
	 *            Current width of this view. 
	 * @param h