修改Android的作物意图作物、意图、Android

由网友(旧梦失词旧歌失语)分享简介:我创建了一个示例应用程序用于裁剪图像,我调用内置的作物意图。I have created a sample app for cropping images and I am calling the built-in crop intent.下面是我的code:Intent intent = new Intent(...

我创建了一个示例应用程序用于裁剪图像,我调用内置的作物意图。

I have created a sample app for cropping images and I am calling the built-in crop intent.

下面是我的code:

Intent intent = new Intent("com.android.camera.action.CROP");
intent.setType("image/*");                  
intent.setData(mImageCaptureUri);
intent.putExtra("outputX", 200);
intent.putExtra("outputY", 200);
intent.putExtra("aspectX", 1);
intent.putExtra("aspectY", 1);
intent.putExtra("scale", true);
intent.putExtra("return-data", true);

如何修改作物的种植面积按照用户的输入?

How can I modify the crop area as per the user's input?

推荐答案

只是删除​​输出/面/缩放参数。

Just remove the output/aspect/scale parameters.

Intent intent = new Intent("com.android.camera.action.CROP");
intent.setType("image/*");                  
intent.setData(mImageCaptureUri);
intent.putExtra("return-data", true);

如果这不给你你想要的结果,重新尝试添加一些参数,但不是全部。

If this doesn't give you the result you want, try adding some of those parameters again, but not all.

请注意!不支持所有设备上的这个动作,所以你也应该检查ActivityNotFoundException当您启动活动,找到一个替代的方式来裁剪这些设备上,或要求用户安装的应用程序为,如下载快。

Note! This action is not supported on all devices, so you should also check for ActivityNotFoundException when you start the activity, find an alternative way to crop on those devices or ask the user to install an app for that such as QuickPic.

阅读全文

相关推荐

最新文章