Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/225.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
android touchimageview缩放已缩放的图像?_Android_Imageview_Zooming_Scale_Touchimageview - Fatal编程技术网

android touchimageview缩放已缩放的图像?

android touchimageview缩放已缩放的图像?,android,imageview,zooming,scale,touchimageview,Android,Imageview,Zooming,Scale,Touchimageview,我正在使用touchimageview放大我的应用程序。当我缩放一幅图像时,它似乎是在缩放图像以适应imagview,而不是缩放图像的原始大小。有没有办法解决这个问题\ iv = new TouchImageView(c); //Center the Image iv.setScaleType(ScaleType.CENTER); LinearLayout.LayoutParams params = new LinearLayou

我正在使用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());
}
/**
*返回缩放图像的位图。此方法与getZoomedImage()不同,因为
*它直接从可绘制源剪切图像,因此不受分辨率限制
*这是我的看法。不支持FIT_XY。
*@返回缩放图像的位图
*/
公共位图getZoomedImageFromSource(){
if(mScaleType==ScaleType.FIT_XY){
抛出新的UnsupportedOperationException(“FIT_XY不支持getZoomedImageFromSource());
}
位图位图=((BitmapDrawable)getDrawable()).getBitmap();
Rect r=getZoomedRect();
如果(r.宽度()