我有這樣的代碼從圖片庫,但即使有intent.putExtra("crop", "true");
獲取圖像,但不會裁剪
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
}
獲取的圖像,選擇圖像後,它不會顯示任何作物活動或任何...爲什麼?
',將scaleType設置爲CenterCrop – longkai
這實際上非常有幫助!我要這樣做,直到我找到合適的方式來裁剪圖像。 – fcasanova
好吧,如果你的圖像非常大,它會出現'outOfMemory'問題,你最好按照谷歌的開發指南或使用庫來裁剪大圖像。 – longkai