0

> 我正在缩放图像以进行缩放,之后我想将缩放后的图像放在图像视图的中心。我怎样才能做到这一点??

    imageview.setScaleType(ScaleType.MATRIX);
    savedMatrix.set(matrix);
    matrix.set(savedMatrix);
    matrix.setScale(.3f, .3f,screen_width/2,screen_height/2);
4

1 回答 1

2

尝试

matrix.postTranslate((screen_width-image_width)/2, (screen_height-image_height)/2);

顺便说一句,你为什么这样做:

savedMatrix.set(matrix);
matrix.set(savedMatrix);

一旦你将矩阵深度复制到 savedMatrix 中,它们是相同的,所以不需要做其他方式。

于 2012-11-08T10:32:34.797 回答