我想使用图库简单图像显示图库或相机中的图像,并使用滑行将其显示到我的对话框片段中。但是图像仍然无法显示。我使用butterKnife绑定查看我的dialogFragment。这是我的一些代码。之前谢谢
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) {
}
});
}```
答案 0 :(得分:0)
也许,您的DialogFragment不能正确显示ImageView。请确保DialogFragment有足够的空间容纳ImageView并按预期显示