【问题标题】:Not able to crop image in android无法在android中裁剪图像
【发布时间】: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


【解决方案1】:

com.android.camera.action.CROP 意图不适用于所有设备,您应该使用库进行裁剪

【讨论】:

    【解决方案2】:

    我不知道你是否可以通过裁剪意图来裁剪图像!

    错误提示 U 正在选择宽度 x 高度小于 50x50 的图像

    尝试选择更大的图像进行裁剪。

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

    【讨论】:

      猜你喜欢
      • 2015-02-02
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多