我有一个ImageView,需要加载一张大图。我有一张低分辨率的该图片可用作预览,在高清晰度图片下载完成并出现在屏幕上之前,我希望能够加载该预览图。
使用以下方法:
我可以得到结果,但无法获得下载图像的位图,因为我不能在同一Glide实例中同时使用.asBitmap、.thumbnail和SimpleTarget。
我的实际代码:
使用以下方法:
private void loadImageThumbnailRequest() {
// setup Glide request without the into() method
DrawableRequestBuilder<String> thumbnailRequest = Glide
.with( context )
.load( eatFoodyImages[2] );
// pass the request as a a parameter to the thumbnail request
Glide
.with( context )
.load( UsageExampleGifAndVideos.gifUrl )
.thumbnail( thumbnailRequest )
.into( imageView3 );
}
我可以得到结果,但无法获得下载图像的位图,因为我不能在同一Glide实例中同时使用.asBitmap、.thumbnail和SimpleTarget。
我的实际代码:
.asBitmap()
.into(new SimpleTarget<Bitmap>(Target.SIZE_ORIGINAL, Target.SIZE_ORIGINAL) {
@Override
public void onResourceReady(Bitmap resource, GlideAnimation glideAnimation) {
mWallpaperImageView.setImageBitmap(resource);
createPaletteAsync(resource);
}
});