Android Glide:在加载实际图像之前显示模糊的图像 [英] Android Glide: Show a blurred image before loading actual image

查看:1016
本文介绍了Android Glide:在加载实际图像之前显示模糊的图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个向用户显示全屏图像的Android应用.从服务器获取图像.我正在使用Glide来显示图像.但是我想在显示实际图像之前显示一个非常小的尺寸的模糊图像.缓存完图片后,应直接显示完整尺寸的图片.

I am developing an Android app which displays full screen images to the user. Images are fetched from the server. I am using Glide to show the image. But I want to display a very small size blurred image before displaying the actual image. Once the image is cached, directly full sized image should be shown.

图像显示流程如下: -如果是第一次下载图像,请先下载一个小比例的图像,然后再下载全分辨率图像. -如果图像是以前下载的,则直接显示完整比例的图像.

Image Displaying flows goes like this: - If image is downloaded for the first time, first download a small scaled image, and then download full resolution image. - If image has been downloaded before, directly show full scale image.

我无法在Glide库中找到任何方法,该方法告诉我缓存中是否存在文件.

I cannot find any method in Glide library, which tell me if a file exist in cache or not.

任何想法,如何做到这一点.

Any idea, how this can be done.

推荐答案

Glide.with(context.getApplicationContext())
                        .load(Your Path)   //passing your url to load image.
                        .override(18, 18)  //just set override like this
                        .error(R.drawable.placeholder)
                        .listener(glide_callback)
                        .animate(R.anim.rotate_backward)
                        .centerCrop()
                        .into(image.score);

这篇关于Android Glide:在加载实际图像之前显示模糊的图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆