How to load remote svg files with Picasso library

别等时光非礼了梦想. 提交于 2020-08-04 19:08:37

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!