如何设置Android的裁剪图像大小固定?如何设置、图像、大小、Android

2023-09-07 10:06:08 作者:四百个萝莉

在我的应用程序,我们使用的是农作物图像,但不想作物面积为可调整大小。在图像中,我不想让红色圆圈下的管制,应该固定在相同尺寸

In my application, we are using the crop image but don't want crop area to be resizable. In the image, I don't want those controls under the red circles, it should be fixed at the same size

   intent.setData(mImageCaptureUri);

                 intent.putExtra("outputX", 200);
                 intent.putExtra("outputY", 200);
                 intent.putExtra("aspectX", 1);
                 intent.putExtra("aspectY", 1);
                 intent.putExtra("scale", true);
                 intent.putExtra("return-data", true);

推荐答案

我终于得到了答案

public void cropCapturedImage(Uri picUri)
    {
        // call the standard crop action intent
        Intent cropIntent = new Intent("com.android.camera.action.CROP");
        cropIntent.setDataAndType(picUri , "image/*");
        cropIntent.putExtra("crop" , "true");
        cropIntent.putExtra("return-data" , true);
        startActivityForResult(cropIntent , 2);
    }