Android Glide 4.0缓存问题处理

1.环境:Android 5.1版本手机,Glide 4.0.0版本
问题:
我在用一个图片转向方法处理了图片后,使用Glide加载新图片到原来的ImageView发现,几乎不会更新,加载方式如下:

Glide.with(activity)
                .asBitmap()
                .load(normalShowPicPath)
                .apply(new RequestOptions()
                        .centerCrop()
                        .priority(Priority.HIGH)//优先级别:高
                )
                .into(image);

处理方式:
1.我在Main线程中使用了 Glide.get(activity).clearMemory();来清理内存
2.我在图片处理的子线程中加了Glide.get(context).clearDiskCache();来清理磁盘缓存
3.最后我使用了这种方式来加载:

 Glide.with(activity)
                .asBitmap()
                .load(normalShowPicPath)
                .apply(new RequestOptions()
                        .centerCrop()
                        .skipMemoryCache(true)//跳过内存缓存
                )
                .into(image);

4.可以正常显示了

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章