使用来自api的picasso在recyclerview中加载图像

Dee*_*pak -6 android picasso

使用picasso从api在RecyclerView中添加图像

and*_*ter 16

使用Picasso加载图像非常简单,你可以这样做Picasso.get().load("http://i.imgur.com/DvpvklR.png").into(imageView);,在他们的网站上你可以得到每一个细节.在您的情况下,您可以解析每个图像URL并用于RecyclerView与Picasso一起显示它们.


Dan*_*das 7

Picasso.get().load("http://i.imgur.com/DvpvklR.png").into(imageView)
Run Code Online (Sandbox Code Playgroud)

在新版本的Picasso中,您不再需要上下文。我正在使用:

implementation 'com.squareup.picasso:picasso:2.71828'
Run Code Online (Sandbox Code Playgroud)


Sha*_*ane 6

尝试这个

String img_url = "YOUR IMAGE URL";
    if (!img_url.equalsIgnoreCase(""))
        Picasso.with(context).load(img_url).placeholder(R.drawable.user_image)// Place holder image from drawable folder
       .error(R.drawable.user_image).resize(110, 110).centerCrop()
       .into("IMAGE VIEW ID WHERE YOU WANT TO SET IMAGE");
Run Code Online (Sandbox Code Playgroud)

快乐编码。


小智 6

在新版毕加索中使用了get() 毕加索最新版毕加索库:2.71828

Picasso
.get()
.load("You Img Path Place Here")
.resize(width, height)
.noFade()
.into("Path set ImageView");
Run Code Online (Sandbox Code Playgroud)

使用最新的毕加索版本

 实现 'com.squareup.picasso:picasso:2.71828'