How to set fixed size of cropped images in Android

2019-06-14 05:30发布

问题:

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);

回答1:

finally i got the answer

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);
    }