protected boolean getChildStaticTransformation
(View child, Transformation trans
)
{ //图像的中心点和宽度
final int childCenter = getCenterOfView(child);
final int childWidth = child.getWidth();
int rotationAngle = 0;
trans.clear();
trans.setTransformationType(Transformation.TYPE_BOTH); // alpha 和 matrix 都变换
if (childCenter == mCoveflowCenter)
{ // 正中间的childView
transformImageBitmap((ImageView) child, trans, 0);
}
else
{ // 两侧的childView
rotationAngle = (int) ( ( (float) (mCoveflowCenter - childCenter) / childWidth ) * mMaxRotationAngle );
if (Math.
abs(rotationAngle
) > mMaxRotationAngle
)
{
rotationAngle = (rotationAngle < 0) ? -mMaxRotationAngle : mMaxRotationAngle;
} //根据偏移角度对图片进行处理,看上去有3D的效果。
transformImageBitmap((ImageView) child, trans, rotationAngle);
}
return true;
}