android – 如何将位图加载到Picasso的图像视图中

android – 如何将位图加载到Picasso的图像视图中,第1张

概述是的,我正在使用毕加索加载位图.原因是我在我的适配器的一部分中解码URI,并在其他位置加载位图,我读取了 here You should always call Picasso, even if your URL is null. This way it knows that the image view was recycled. 所以我试过这个…. Bitmap bitMap;...P 是的,我正在使用毕加索加载位图.原因是我在我的适配器的一部分中解码URI,并在其他位置加载位图,我读取了 here

You should always call Picasso,even if your URL is null. This way it kNows that the image vIEw was recycled.

所以我试过这个….

Bitmap bitMap;...Picasso.with(getContext())    .load(bitMap)    .into(imageVIEw);

但是我收到了这个错误

cannot resolve method ‘load(androID.graphics.Bitmap)’

解决方法 您不能将Bitmap用于毕加索的加载方法.您只能使用uri,file,url path和int资源ID.

如果您从url下载图像,则可以像下面的代码一样:

String url = "your_url";Picasso.with(context).load(url)    .placeholder(R.drawable.any_drawable)    .error(R.drawable.anydrawable).into(your_imageVIEw);

对于其他资源相同,只有load方法参数会根据您使用的资源而改变.

总结

以上是内存溢出为你收集整理的android – 如何将位图加载到Picasso的图像视图中全部内容,希望文章能够帮你解决android – 如何将位图加载到Picasso的图像视图中所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/web/1132604.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-30
下一篇 2022-05-30

发表评论

登录后才能评论

评论列表(0条)

保存