我必须从图库中选择图像或从相机中捕获图像,我想裁剪我得到的图像,
所以,我使用下面的代码来调用 crop intent,
Intent cropIntent = new Intent("com.android.camera.action.CROP");
//indicate image type and Uri
cropIntent.setDataAndType(imageUri, "image/*");
//set crop properties
cropIntent.putExtra("crop", "true");
//retrieve data on return
cropIntent.putExtra("return-data", true);
try {
startActivityForResult(cropIntent, REQUEST_CODE_FOR_CROP_DONE);
} catch (ActivityNotFoundException actionNotFoundException) {
Log.e(TAG, actionNotFoundException.getMessage(), actionNotFoundException);
Toast.makeText(fragment.getActivity(), fragment.getResources().getString(R.string.crop_not_available), Toast.LENGTH_SHORT).show();
}
我正在使用 Nexus 6p 设备,似乎只有在这个设备上我才会遇到这个问题。
这给了我 Toast 消息说不能裁剪低于 50 x 50 的图像。
我可以知道我错过了什么吗?
最佳答案
此 com.android.camera.action.CROP
Intent 不适用于所有设备,您应该使用库进行裁剪
关于android - 无法在android中裁剪图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40521763/