Android轮播,图像透视转换

时间:2016-08-02 12:06:04

标签: java android matrix imageview transform

你能帮我解决一下如何在屏幕截图中使用图片制作Android视图:

enter image description here

必须适合屏幕宽度。 我可以从左边转换第一个图像,如:

    ImageView img;
    float degrees = 70;
    Camera mCamera = new Camera();
    final float mCenterX = img.getWidth() / 2.0f;
    final float mCenterY = img.getHeight() / 2.0f;

    final float centerX = mCenterX;
    final float centerY = mCenterY;
    final Camera camera = mCamera;

    Matrix matrix = new Matrix();

    camera.save();

    camera.rotateY(degrees);

    camera.getMatrix(matrix);
    camera.restore();

    matrix.preTranslate(-centerX, -centerY);
    matrix.postTranslate(centerX, centerY);
    img.setImageMatrix(matrix);

在布局中,imageView存储在Horizo​​ntal LinearLayout中。但是图像宽度不能通过矩阵变换重新计算。

请帮我实现这个布局,如图所示。

0 个答案:

没有答案