问题
I'm building an android app that requires downloading svg images from a server. I have tried using Picasso the usual way but it displays nothing.
Picasso.get().load(url).into(imageView)
Is there anyway to display vector images with Picasso?
回答1:
You can use a library called GlideToVectorYou which uses Glide internally.
fun ImageView.loadSvg(url: String?) {
GlideToVectorYou
.init()
.with(this.context)
.setPlaceHolder(R.drawable.loading, R.drawable.actual)
.load(Uri.parse(url), this)
}
回答2:
My advice, try to move to Glide library. Under hood, lib could load svg and much more things. Here is an examples.
来源:https://stackoverflow.com/questions/53915396/how-to-load-remote-svg-files-with-picasso-library