アプリでズームするために touchimageview を使用しています。画像をズームすると、画像の元のサイズにズームするのではなく、imagview に合わせてスケーリングされた画像にズームしているようです。これを修正する方法はありますか?\
iv = new TouchImageView(c);
//Center the Image
iv.setScaleType(ScaleType.CENTER);
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(
LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
params.weight = 1.0f;
params.gravity=Gravity.CENTER;
iv.setLayoutParams(params);
drawable = (AnimationDrawable)c.getResources().getDrawable(R.drawable.loading_animation);
UrlImageViewHelper.setUrlDrawable(iv, url,drawable);
編集: touchimageview クラスでこのメソッドを見つけましたが、デフォルトのズーム効果で動作するように実装する方法がわかりません...
/**
* Return a bitmap of the zoomed image. This method is different from getZoomedImage() because
* it cuts the image directly from the drawable source, and thus, is not limited by the resolution
* of the view. Not supported with FIT_XY.
* @return bitmap of zoomed image
*/
public Bitmap getZoomedImageFromSource() {
if (mScaleType == ScaleType.FIT_XY) {
throw new UnsupportedOperationException("getZoomedImageFromSource() not supported with FIT_XY");
}
Bitmap bitmap = ((BitmapDrawable) getDrawable()).getBitmap();
Rect r = getZoomedRect();
if (r.width() <= 0 || r.height() <= 0) {
return null;
}
return Bitmap.createBitmap(bitmap, r.left, r.top, r.width(), r.height());
}