使用库在弹出窗口中显示图像
Showing image in popup using a library
我正在尝试使用此库
在弹出窗口中显示图像 window
implementation 'com.github.chathuralakmal:AndroidImagePopup:1.2.1'
一切正常,但弹出窗口仍然空白,没有图像
我认为问题是我正在使用 glide 从 URL 下载图像并在图像视图中显示它:
这是我的代码:
Glide.with(this).load(cleaned_image).apply(requestOptions).into(cleaned_img);
final ImagePopup imagePopup = new ImagePopup(this);
imagePopup.setWindowHeight(800); // Optional
imagePopup.setWindowWidth(800); // Optional
imagePopup.setBackgroundColor(Color.BLACK); // Optional
imagePopup.setFullScreen(true); // Optional
//imagePopup.setHideCloseIcon(true); // Optional
imagePopup.setImageOnClickClose(true); // Optional
imagePopup.initiatePopup(cleaned_img.getDrawable());
cleaned_img.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
imagePopup.viewPopup();
}
});
在我的例子中,我只是添加了不可绘制的可绘制 ID,它适用于 me.Like 这个
imagePopup.initiatePopup(context.getResources().getDrawable(image_list.get(position)));
其中图像列表是drawable id的arraylist
如果您使用 Glide,只需尝试弹出库作者 (https://github.com/chathuralakmal/AndroidImagePopup) 为 Glide 建议的解决方案:
imagePopup.initiatePopupWithGlide(cleaned_image);
使用这个版本的 Glide
implementation 'com.github.bumptech.glide:glide:4.0.0'
kapt 'com.github.bumptech.glide:compiler:4.0.0'//for kotlin
annotationProcessor 'com.github.bumptech.glide:compiler:4.0.0'
我正在尝试使用此库
在弹出窗口中显示图像 windowimplementation 'com.github.chathuralakmal:AndroidImagePopup:1.2.1'
一切正常,但弹出窗口仍然空白,没有图像
我认为问题是我正在使用 glide 从 URL 下载图像并在图像视图中显示它:
这是我的代码:
Glide.with(this).load(cleaned_image).apply(requestOptions).into(cleaned_img);
final ImagePopup imagePopup = new ImagePopup(this);
imagePopup.setWindowHeight(800); // Optional
imagePopup.setWindowWidth(800); // Optional
imagePopup.setBackgroundColor(Color.BLACK); // Optional
imagePopup.setFullScreen(true); // Optional
//imagePopup.setHideCloseIcon(true); // Optional
imagePopup.setImageOnClickClose(true); // Optional
imagePopup.initiatePopup(cleaned_img.getDrawable());
cleaned_img.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
imagePopup.viewPopup();
}
});
在我的例子中,我只是添加了不可绘制的可绘制 ID,它适用于 me.Like 这个
imagePopup.initiatePopup(context.getResources().getDrawable(image_list.get(position)));
其中图像列表是drawable id的arraylist
如果您使用 Glide,只需尝试弹出库作者 (https://github.com/chathuralakmal/AndroidImagePopup) 为 Glide 建议的解决方案:
imagePopup.initiatePopupWithGlide(cleaned_image);
使用这个版本的 Glide
implementation 'com.github.bumptech.glide:glide:4.0.0'
kapt 'com.github.bumptech.glide:compiler:4.0.0'//for kotlin
annotationProcessor 'com.github.bumptech.glide:compiler:4.0.0'