我已经将我的当前项目从Picasso切换到Glide。但是,我无法从应用程序资产中加载图像。这是否可能?
示例代码:
String assetPath = "file:///android_asset/flags/FR.jpg";
Glide.with(getContext())
.load(Uri.parse(assetPath))
.placeholder(missingFlagDrawable)
.centerCrop()
.crossFade()
.into(flag);
我也尝试了使用load(String)方法,但没有成功。我没有看到一个可以使用InputStream或FileDescriptor的load方法,这些可以通过AssetManager类获得。
同样的代码在Picasso中是有效的。
Glide在应用程序的其他部分正常工作,并且可以很好地加载远程图像。