【发布时间】:2014-03-13 12:43:06
【问题描述】:
我有这段代码可以从图库中检索图像
Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
intent.setType("image/*");
intent.putExtra("crop", "true");
intent.putExtra("aspectX", 0);
intent.putExtra("aspectY", 0);
intent.putExtra("outputX", 360);
intent.putExtra("outputY", 360);
try
{
intent.putExtra("return-data", true);
startActivityForResult(Intent.createChooser(intent, "Complete action using"), req_code);
}
catch(ActivityNotFoundException e)
{
// Do nothing for now
}
但即使使用intent.putExtra("crop", "true");,在选择图像后,它也不会显示任何裁剪活动或其他任何东西......为什么?
【问题讨论】:
-
在您的
ImageView中,将 scaleType 设置为 CenterCrop -
这实际上很有帮助!我会一直这样做,直到找到合适的方法来裁剪图像。
-
好吧,如果你的图片很大,会出现
outOfMemory的问题,你最好按照谷歌的开发者指南或者使用库来裁剪大图。 -
是的,至少我暂时有办法!
-
好的,但你应该注意这一点。
标签: android android-intent crop