Comments (8)
我在开发微博的时候,也遇到这个问题。最后确定问题是由于RecyclerView复用ViewHolder引起的,
RecyclerView内部会自动判断ViewHolder是否需要重新刷新来加载新的数据,这套判断的逻辑有时候遇到一些复杂的item布局的时候,就会出现问题,导致一些有图的微博item复用了之前无图的微博item的ViewHolder,图片也就显示不出来了
解决办法:让RecyclerView认为这个ViewHolder需要重新刷新来加载新的数据
在设置图片前,手动调用
(Viewholder).recyclerview.setVisibility(View.GONE);
(Viewholder).recyclerview.setVisibility(View.VISIBLE);
这样图片就不会出现乱序问题了
from weibo.
这两句我加上了的,然而还是会乱,好忧桑。。。
from weibo.
使用ImageLoader是否有使用占位图?尝试使用下列代码给ImageLoader增加如下配置:
options = new DisplayImageOptions.Builder()
.showImageOnLoading(R.drawable.message_image_default)
.showImageForEmptyUri(R.drawable.message_image_default)
.showImageOnFail(R.drawable.message_image_default)
.cacheInMemory(true)
.cacheOnDisk(true)
.considerExifParams(true)
.build();
ImageLoader.getInstance().displayImage(mData.get(position), holder.imageItem, options);
图片可以自己设置
from weibo.
嗯,这些当然都设置了
from weibo.
写下你的开源项目的地址,我帮你看一下
from weibo.
lz,我发你的源码你收到了吗
from weibo.
没有收到,请发到[email protected]
from weibo.
可参考Android-Universal-Image-Loader中机制,将ImageView的hashcode作为key,图片url作为value,存储线程安全的hashmap中。下载后display时,根据ImageView的hashcode从hasmap中取图片url,如果被复用了,那么取出来的url与图片的url不一致,不需要显示。
from weibo.
Related Issues (20)
- 微博详情页转发评论悬浮 HOT 2
- 评论失败
- 大神怎么不继续维护这个项目了? HOT 2
- 关于下拉刷新与上拉加载更多 HOT 1
- 大神,关于recyclerview置顶以及取消置顶有没有好的方案,百度谷歌找遍了,自己实现的时候问题颇多 HOT 2
- 运行一直卡住在 gradle:resolve dependencies ':multiwindow:_debugPublish' HOT 1
- 关于微博图片浏览器区别加载普通图片、长图、gif HOT 1
- 无法登陆 HOT 1
- 这个客户端的微博授权过期了,大佬,无法登陆了 HOT 1
- Saving image error.
- 强烈建议加入抢沙发功能
- 点击图片 程序退出
- 点击登录的时候Weico授权失效了
- 啊
- 无法登陆? HOT 1
- 无法登陆?
- 无法登陆:对第三方应用授权时出现错误
- 用我自己的微博授权点击登录后显示是空白
- 在网盘下载的无法注册账号
- 网盘链接炸了
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from weibo.