Android – displays progress when downloading images from the server to ImageView

I'm listview and want to display the progress until the image is not downloaded from the server to ImageView using Picasso library_ Launcher drawable and download the image from the server to ImageView at the same time, but what if I want to display the progress?

    Picasso.with(context)
    .load(imageURL)
    .transform(transformation)
    .placeholder(R.drawable.ic_launcher)
    .error(R.drawable.ic_launcher)
    .into(viewHolder.imageView);

resolvent:

In the XML file, you must place the progress bar above the image and set the visibility of the progress bar to visible and in your code

Picasso.with(context)
       .load(file)
       .into(imageView, new Callback() {
           @Override
           public void onSuccess() {
               progressbar.setVisibility(View.GONE);
           }
       });

When downloading images, you must set setvisibility (view. Gone) as the progress bar

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>