New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
怎么判断adapter中的imageView重用 #1302
Comments
Picasso keeps a map of ImageView -> URL and when the same ImageView is seen twice, the loading of the original URL is canceled and and new one is started. |
a simple way is set the url as a tag into one View(ImageView). You just need to check if the new url is same or not with the tagged one. See View.setTag(Object obj) and View.getTag() |
thanks for answer,我的需求是加载好友头像,因为涉及到好友头像变更等,所以没有完全使用Picasso来下载并加载头像,而是先通过okhttp下载头像到SDCard,然后再用Picasso加载,我在下载之前设置了tag,下载完成后比较tag是否相同.在listView快速滑动时,头像下载很快,但是Picasso从SDCard加载头像用时200多ms,导致了头像错乱问题(就是已经进入到if (reqUrl.equals(tagUrl)) 条件里面,然后adapter被刷出界面重用了,这个好友使用默认头像,但是200多ms后被修改成上一个人的头像了)
|
记得貌似好像大约Google给的教程里有类似的解决方式~ |
我觉得你在这里问不太好,你应该发到 stackoverflow you should ask for stackoverflow instead of issue |
围观 JakeWharton ^_^ |
JakeWharton ^_^ |
JakeWharton 哈哈 ^_^ |
JakeWharton ^_^ |
1 similar comment
JakeWharton ^_^ |
you are my idol . JakeWharton ^_^ |
大神太棒了!@JakeWharton 你懂的 |
JakeWharton 哈哈 ^_^ |
语言不是障碍了 , 围观 JakeWharton 大神 |
I think you are right |
thanks everyone |
six six six |
我想知道Picasso是怎么检测到imageView被重用的,源代码里面没看到,现在我遇到一个问题,就是关于重用的
The text was updated successfully, but these errors were encountered: