Intent intent = new Intent("com.android.camera.action.CROP");
intent.setDataAndType(uri, "image/*");
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
}
intent.putExtra("crop", "true");
// 裁剪框的比例,4:3
intent.putExtra("aspectX", 4);
intent.putExtra("aspectY", 3);
// 裁剪后輸出圖片的尺寸大小
intent.putExtra("outputX", 800);
intent.putExtra("outputY", 600);
intent.putExtra("outputFormat", Bitmap.CompressFormat.PNG.toString());
intent.putExtra("noFaceDetection", true);
intent.putExtra("return-data", false);
intent.putExtra(MediaStore.EXTRA_OUTPUT, cropImageUri);
// 開啟一個帶有回傳值的Activity,請求碼為PHOTO_REQUEST_CUT
startActivityForResult(intent, PHOTO_REQUEST_CUT);
uj5u.com熱心網友回復:
好像有個CircleImageView的控制元件,參考下試試轉載請註明出處,本文鏈接:https://www.uj5u.com/yidong/130716.html
標籤:Android
上一篇:AFNetworking如何將responseObject傳遞出來?
下一篇:webview瀏覽word檔案
