TakePhoto的照片選擇器的使用(多選)


參考項目地址 https://blog.csdn.net/iamchan/article/details/81261524
https://github.com/bumptech/glide 此項目中glide使用 3.7.0 高版本的報錯 為啥`````俺也不知

github地址 https://github.com/crazycodeboy/TakePhoto
在按鈕里面直接調用onClickTake(getTakePhoto);即可
public void onClickTake(TakePhoto takePhoto) {
configCompress(takePhoto);
takePhoto.onPickMultiple(1);//根據需求這里面放最大圖片數 單選使用takePhoto.onPickFromGallery();
}

private void configCompress(TakePhoto takePhoto) {//壓縮的配置
int maxSize = Integer.parseInt("409600");//最大 壓縮
int width = Integer.parseInt("800");//寬
int height = Integer.parseInt("800");//高
CompressConfig config;
config = new CompressConfig.Builder().setMaxSize(maxSize)
.setMaxPixel(width >= height ? width : height)

.enableReserveRaw(false)//拍照壓縮后是否顯示原圖
.create();
takePhoto.onEnableCompress(config, false);//是否顯示進度條

}

需要實現繼承 TakePhotoActivity 或者 TakePhotoFragment
實現 takeSuccess() takeFail() takeCancel()

takeSuccess 方法中可以取到返回值的圖片 像這樣
public void takeSuccess(TResult result) {
super.takeSuccess(result);
Glide.with(getApplicationContext()).load(result.getImages().get(0).getCompressPath()).into(ivTest);
}


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM