bumptech / bumptech/glide

ImageView twinkle when use post to load url

Open
#4,393 1 comment 0 reactions 0 assignees View on GitHub
stale
Dominant language
Java
Stars
35k
Forks
6.2k
Avg merge
1d 11h
Merged PRs (30d)
8

Description

**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);
}
}
}

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.