簡體   English   中英

Android在OS 2.3上拾取圖像

[英]Android pick and crop image on OS 2.3

有什么辦法可以從內置的Android畫廊上實現2.3的拾取和裁剪圖像? 我找到了這個庫: com.android.camera.action.CROP替代?

但它似乎僅適用於API lvl 15及更高版本。

有很多從相機裁剪圖像的方法。 例如:通過使用意圖活動作為結果:

Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);

intent.putExtra(MediaStore.EXTRA_OUTPUT,
MediaStore.Images.Media.EXTERNAL_CONTENT_URI.toString());
// ******** code for crop image
intent.putExtra("crop", "true");
intent.putExtra("aspectX", 0);
intent.putExtra("aspectY", 0);
intent.putExtra("outputX", 200);
intent.putExtra("outputY", 150);

try {

intent.putExtra("return-data", true);
startActivityForResult(intent, PICK_FROM_CAMERA);

} catch (ActivityNotFoundException e) {
// Do nothing for now
}
}

或參考這些網站以獲取更多幫助:

http://www.londatiga.net/featured-articles/how-to-select-and-crop-image-on-android/ http://www.androidhub4you.com/2012/07/how-to-crop-圖像從相機-and.html

我使用了以下作物庫。 它真的很好,它支持2.3及更高版本。 試試吧。

https://github.com/biokys/cropimage

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM