I want to load a svg file from the web and show this file in an ImageView. For non vector images I use the Picasso library.
Is it possible to use this library for svg files as well?
Is there any way to load svg files from the web and show it in an ImageView?
I use the svg-android library to show svg files but i don't know how to get svg images from the web all the examples for this library use local files.
Use this
Glide based library
loading xmlAdd dependency
for latest android dependency Gradle use this instead
main.xml
MainActivity.java
Please refer to Having issue on Real Device using vector image in android. SVG-android
In the users post he asks a similar question and suggest he uses:
Create a member variable for the ImageView in your layout file;
Download the image
Then Apply the drawable to the Imageview
SVGParser is available at https://github.com/pents90/svg-android
You can use this library
https://github.com/2coffees1team/GlideToVectorYou
As he say : "The library is based on Glide and offers the same functionalities + svg support".
Update: For newer version please checkout the Glide Samples (https://github.com/bumptech/glide/tree/master/samples/svg)
-
You can use Glide (https://github.com/bumptech/glide/tree/v3.6.0) and AndroidSVG (https://bitbucket.org/paullebeau/androidsvg).
There is also a sample from Glide: https://github.com/bumptech/glide/tree/v3.6.0/samples/svg/src/main/java/com/bumptech/svgsample/app
Setup GenericRequestBuilder
Use RequestBuilder with uri