I want to show image from gallery or camera using library easy image and appear it using glide to my dialog Fragment. But the image still can't show. I use butterKnife to bindView my dialogFragment. Here is my some code. Thanks before
EasyImage.handleActivityResult(requestCode, resultCode, data, getActivity(),
new DefaultCallback() {
@Override
public void onImagePickerError(Exception e, EasyImage.ImageSource source, int type) {
}
@Override
public void onImagePicked(File imageFile, EasyImage.ImageSource source, int type) {
switch (type) {
case REQUEST_CODE_GALLERY:
Glide.with(context)
.load(imageFile)
.centerCrop()
.into(ivPhotoProfile);
ViewUtils.showLog("photo" + ivPhotoProfile);
ivPhotoProfile.setVisibility(View.VISIBLE);
break;
case REQUEST_CODE_CAMERA:
imageTaken = ImageUtils.compressImage(imageFile,ImageUtils.createPhotoFile(getActivity()));
Glide.with(Objects.requireNonNull(getActivity()))
.load(imageTaken)
.apply(RequestOptions.fitCenterTransform())
.into(ivPhotoProfile);
break;
}
}
@Override
public void onCanceled(EasyImage.ImageSource source, int type) {
}
});
}```
可能是您的DialogFragment无法正确显示ImageView。请确保DialogFragment有足够的空间容纳ImageView并按预期显示
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.