bumptech / glide

An image loading and caching library for Android focused on smooth scrolling
https://bumptech.github.io/glide/
Other
34.59k stars 6.12k forks source link

ImageView twinkle when use post to load url #4393

Open Lwarrior07 opened 3 years ago

Lwarrior07 commented 3 years ago

Glide Version:4.10.0

Integration libraries:

Device/Android Version:Android 10.0

I use glide to load image in recycleview. I need to modify the url by height and width as params. So I use 'post' to load imageview,then I can get measured height and width. When I scroll recyclerview slowly,it works well. But if I scroll recyclerview fast, the imageView may twinkle. I think because of 'post', the imageView load different urls many times. How can I fix this issue?

Code like this:

public void onBindVIewHolder(CustomViewHolder holder, int position) { holder.imageView.post(new Runnable(){ public void run() { String newUrl = buildUrl(oldUrl, imageView.getMeasuredWidth(), imageView.getMeasureHeight()); GlideApp.with(fragment).load(newUrl).into(imageView); } } }

stale[bot] commented 3 years ago

This issue has been automatically marked as stale because it has not had activity in the last seven days. It will be closed if no further activity occurs within the next seven days. Thank you for your contributions.