Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
> 我正在缩放图像以进行缩放,之后我想将缩放后的图像放在图像视图的中心。我怎样才能做到这一点??
imageview.setScaleType(ScaleType.MATRIX); savedMatrix.set(matrix); matrix.set(savedMatrix); matrix.setScale(.3f, .3f,screen_width/2,screen_height/2);
尝试
matrix.postTranslate((screen_width-image_width)/2, (screen_height-image_height)/2);
顺便说一句,你为什么这样做:
savedMatrix.set(matrix); matrix.set(savedMatrix);
一旦你将矩阵深度复制到 savedMatrix 中,它们是相同的,所以不需要做其他方式。