使用Glide库从应用程序资源中加载图像
问题描述:
我已将当前项目从毕加索切换到Glide。但是,我无法从应用程序资产中加载图像。这甚至有可能吗?使用Glide库从应用程序资源中加载图像
示例代码:
String assetPath = "file:///android_asset/flags/FR.jpg";
Glide.with(getContext())
.load(Uri.parse(assetPath))
.placeholder(missingFlagDrawable)
.centerCrop()
.crossFade()
.into(flag);
我也曾尝试负载(String)方法没有成功,我没有看到服用,例如InputStream还是我可以与AssetManager取得FileDescriptor的负载方法类。
完全相同的代码在毕加索工作。
Glide在应用程序的其余部分正常工作并加载很好的远程图像。
我看到你已经打开了一个问题,thx – peko 2014-09-25 12:09:12
是的,在这里解决后会发布权威答案。 – 2014-09-25 13:39:33
对于后人,资产Uris在Glide 3.4之前不受支持,此处引用的问题是https://github.com/bumptech/glide/issues/155。 – 2014-12-26 17:15:41