I'm using a modified version of this slider lib that uses fresco lib instead of Picasso.
I'm getting the SVG
from a RESTful server as a String. And the loading process works somewhat like:
protected void bindEventAndShow(final View v, SimpleDraweeView targetImageView){
// ...
// This URL is provided elsewhere, just putting it here for readability.
String url = "http://foo.bar/resource";
ControllerListener controllerListener = new BaseControllerListener<ImageInfo>() {
// onFinalImageSet(), onIntermediateImageSet(), onFailure methods here
}
DraweeController controller = Fresco.newDraweeControllerBuilder().setControllerListener(controllerListener)
.setImageRequest(ImageRequest.fromUri(url))
.build();
// ...
targetImageView.setHierarchy(hierarchy);
targetImageView.setController(controller);
}
When I provide a URL with PNG
or JPEG
, it works wonders. But if the URL gives back a SVG
, it doesn't work at all.
I want to know if it's possible to load a SVG
String/File directly into Fresco. If it's not possible directly, how can it be done?
P.S.: I could try to transform it to PNG
or JPG
, save it on disk and only then load it on the slider, but I'm not sure if it's the best approach.
Acording with github repository, they dont support svg.
https://github.com/facebook/fresco/issues/1008
https://github.com/facebook/fresco/issues/329
You should use other library like glide.
https://github.com/bumptech/glide
An example: