问题
Add image in RecyclerView from api using picasso
回答1:
Image loading using Picasso is very easy, you can do it like this way Picasso.get().load("http://i.imgur.com/DvpvklR.png").into(imageView);
and in their website you can get every details. In your case you can parse every image URL and use RecyclerView
to show them along with Picasso.
回答2:
Picasso.get().load("http://i.imgur.com/DvpvklR.png").into(imageView)
In the new versions of Picasso you don't need the context anymore. I'm using:
implementation 'com.squareup.picasso:picasso:2.71828'
回答3:
Try this
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");
Happy coding.
回答4:
You can load image using picasso like this way
Picasso.with(context).load(android_versions.get(i).getAndroid_image_url()).resize(120, 60).into(viewHolder.img_android);
https://www.learn2crack.com/2016/02/image-loading-recyclerview-picasso.html
回答5:
Here ctx is context, list.getImage_full_path())
is image coming from server, in placeholder a static image is placed if image is not loaded, on error kent is name of image and into(servicecart_image)
is placed in XML so image is loaded there
Picasso.with(ctx).load(list.getImage_full_path()).resize(160, 200).placeholder(R.drawable.kent)
.error(R.drawable.kent).into(servicecart_image);
来源:https://stackoverflow.com/questions/41156698/loading-images-in-recyclerview-with-picasso-from-api