0
在我的应用程序要求是从图库中选择图像,然后裁剪所选图像并设置为图像视图。以下是我裁剪图像的示例代码。如何使用默认裁剪意图裁剪android棉花糖中的图像?
//call the standard crop action intent (the user device may not support it)
Intent cropIntent = new Intent("com.android.camera.action.CROP");
cropIntent.setClassName("com.android.camera", "com.android.camera.CropImage");
//indicate image type and Uri
cropIntent.setDataAndType(mImageCaptureUri, "image/*");
//set crop properties
cropIntent.putExtra("crop", "true");
//indicate aspect of desired crop
cropIntent.putExtra("aspectX", 1);
cropIntent.putExtra("aspectY", 1);
//indicate output X and Y
cropIntent.putExtra("outputX", 256);
cropIntent.putExtra("outputY", 256);
//retrieve data on return
cropIntent.putExtra("return-data", true);
cropIntent.putExtra(MediaStore.EXTRA_OUTPUT, mImageCaptureUri);
cropIntent.addFlags(Intent.FLAG_GRANT_WRITE_URI_PERMISSION);
//start the activity - we handle returning in onActivityResult
startActivityForResult(cropIntent, PIC_CROP);
上面的代码工作正常,在下面的Android棉花糖图谋但是Android蜀葵,它是crashing.How解决这个问题?
[Android没有'CROP'' Intent'](https://commonsware.com/blog/2013/01/23/no-android-does-not-have-crop-intent.html)。有很多[可用于Android的图像裁剪库](https://android-arsenal.com/tag/45)。请使用一个。 – CommonsWare
@CommonsWare感谢您的回复,是android棉花糖没有作物意图? – Rajesh
@CommonsWare我试图添加裁剪库,但应用程序大小增加。这就是我寻找默认裁剪的原因 – Rajesh