2016-11-10 32 views
1

我有选择的图像无论是从画廊或捕捉的相机图像,我想裁剪图像我所得到的,无法裁切的Android

所以,我用下面的代码来调用作物意图,

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设备,似乎只有在这个设备上我面临这个问题。

这给我敬酒消息说,可以在下面50×50

不作物图像可能我知道我缺少什么?

+1

请查看本博客:https://commonsware.com/博客/ 2013/01/23 /无的Android此结果不具备的,作物intent.html –

回答

1

com.android.camera.action.CROP的意图并不在所有设备上工作,你应该使用库croping

1

我不知道你是否可以通过传递作物意图裁剪图像!

误差表示U的选择具有宽度x高度小于50×50

尝试选择较大的图像用于裁剪工作的图像。

PS:尝试使用这个库裁剪Android-Image-Cropper