android - 无法在android中裁剪图像

标签 android image android-intent crop

我必须从图库中选择图像或从相机中捕获图像,我想裁剪我得到的图像,

所以,我使用下面的代码来调用 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/

相关文章:

android - 添加另存为图像以实现共享 Intent

android - 使用 Zxing 条码扫描器导致 SecurityException

Android - Gradle : error: package does not exist

c# - 使用 C# 从二维数组绘制 .bmp

css - 我应该将 OctoberCMS 的图像文件放在哪里

按导航栏后退按钮时,Android Activity 返回到启动它的 Activity 而不是父 Activity

android - 将gradle中的外部jar添加到Android项目

android - 不幸的是在 Google Maps api v2 中停止

android - 尝试模拟 AdView 类时出现 VirtualMachine 错误

html - 文本环绕图像,到一列