【发布时间】:2016-11-10 07:07:41
【问题描述】:
我必须从图库中选择图像或从相机中捕获图像,我想裁剪我得到的图像,
所以,我使用以下代码来调用裁剪意图,
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 的图像。
我可以知道我错过了什么吗?
【问题讨论】:
标签: android image android-intent crop