由网友(つ唯恐天下不乱丶)分享简介:我使用的是壁画库。我找不到任何相关信息的壁画文档中,我怎样才能从壁画的磁盘缓存得到的图像文件?I can't find any related info in the Fresco documentation,how can I get an image file from Fresco's disk cach...
我使用的是壁画库。
我找不到任何相关信息的壁画文档中, 我怎样才能从壁画的磁盘缓存得到的图像文件?
I can't find any related info in the Fresco documentation, how can I get an image file from Fresco's disk cache?
推荐答案
您必须创建一个DiskCacheConfig,把它传递给ImagePipelineConfig然后初始化壁画与配置:
You will have to create a DiskCacheConfig, pass it to ImagePipelineConfig and then init Fresco with that config:
DiskCacheConfig diskCacheConfig = DiskCacheConfig.newBuilder().setBaseDirectoryPath("/sdcard/")
.setBaseDirectoryName("v1")
.setMaxCacheSize(100 * ByteConstants.MB)
.setMaxCacheSizeOnLowDiskSpace(10 * ByteConstants.MB)
.setMaxCacheSizeOnVeryLowDiskSpace(5 * ByteConstants.MB)
.setVersion(1)
.build();
ImagePipelineConfig imagePipelineConfig = ImagePipelineConfig.newBuilder(context).setMainDiskCacheConfig(diskCacheConfig).build();
Fresco.initialize(context, imagePipelineConfig);
然后壁画就知道是否应该获取来自网络或磁盘
Then Fresco will know whether it should fetch from network or disk
相关推荐
最新文章