我创建了一个图像库,一切正常。要放大和移动图像需要将矩阵图像定位在图像视图的中心
ImgView.setScaleType (ImageView.ScaleType.MATRIX)
,当我这样做,我得到的图像小,所以我调用的方法
scaleFactor = view.getWidth()/(float)view.getDrawable().getIntrinsicWidth();
matrix.setScale(scaleFactor, scaleFactor);
所以千万不要错过图像大小,但作为你可以看到,图像高于一切,需要留在屏幕的中心。
我想这
matrix.postTranslate((screen_width-image_width)/2, (screen_height-image_height)/2);
,但不起作用。
有什么想法?对不起,不插入图片,但我不能因为我的声誉。 非常感谢你提前
您是否试过指定轴心点? 'matrix.setScale(scaleFactor,scaleFactor,view.getWidth()/ 2,view.getHeight()/ 2);' –
是的,我试过但没有任何结果。图片仍然没有得到中间。谢谢你的回答。 – sergio