Android Picasso Image does not load

后端 未结 16 1703
醉梦人生
醉梦人生 2020-12-10 04:02

There are two situations I load images, first, just directly from the internet, and second, load images that are downloaded in the device. And whenever I load, 8~9 out of 10

相关标签:
16条回答
  • 2020-12-10 04:22

    Nobody will be as dumb as me, but for completeness: if you add a tint color to the image view in your layout file it will obscure the successfully loaded image.

    0 讨论(0)
  • 2020-12-10 04:23

    Take a look of Picasso: out of memory

    Check that you use fixed size in your ImageView, refer to more info to @Samuil Yanovski answer

    Hope this helps!!

    0 讨论(0)
  • 2020-12-10 04:28

    Try to replace "http:" at the start of your Url with "https:" (if it applies)

    (on your String representation of Url).replace("http:", "https:");
    

    Works for me.

    0 讨论(0)
  • 2020-12-10 04:30

    Make sure your imageUrl contains https instead of http If your imageUrl contain http then creat network_Security_config file under res folder xml folder and mention the URL E.g

        <<network-security-config>
                <domain-config cleartextTrafficPermitted="true">
                    <domain includeSubdomains="true">www.your_domain.com</domain>
                </domain-config>
        </network-security-config>
    
    0 讨论(0)
  • 2020-12-10 04:31

    Maybe this helps someone,

    For my url I was using http://localhost:8080/api/get-image/image.jpg...

    You need to set instead of localhost, the server's ip!!

    0 讨论(0)
  • 2020-12-10 04:32
     Picasso.with(activity)
                .load(path)
                .placeholder(R.drawable.thumbnail_placeholder)
                .resize(width,height)
                .into(imageView);
    
    replace it with this below code
    
     Picasso.get()
                .load(path)
                .placeholder(R.drawable.thumbnail_placeholder)
                .resize(width,height)
                .into(imageView);
    
    0 讨论(0)
提交回复
热议问题