1
final float viewWidth = getImageViewWidth(mImageView);
final float viewHeight = getImageViewHeight(mImageView);
final int drawableWidth = drawable.getIntrinsicWidth();
final int drawableHeight = drawable.getIntrinsicHeight();
mBaseMatrix.reset();
final float widthScale = viewWidth / drawableWidth;
final float heightScale = viewHeight / drawableHeight;
float scale = Math.max(widthScale, heightScale);
mBaseMatrix.postScale(scale, scale);
mBaseMatrix.postTranslate((viewWidth - drawableWidth * scale) / 2F,(viewHeight - drawableHeight * scale)/ 2F);

在这里,我用它来从中心缩放图像,但我的选项是它从中心缩放图像并翻译它?除了缩放和翻译之外,还有其他选择吗?或者我可以拥有与每个移动画廊相同的照片视图吗?

4

0 回答 0