Open ppamorim opened 9 years ago
Please provide a piece of the code used in your RecyclerView.Adapter for analysis. Have you tested Universal-Image-Loader directly with RecyclerView 21.0.1?
Yes, with 21.0.1.
@ppamorim Thanks for enter your code, I'm analysing it :+1:
@ppamorim Have you enabled caching in Universal Image Loader? It is not enabled by default according the documentation, if caching is disabled, when the images reach the memory cache threshold that is relatively small, new threads will be spawned generating new workloads and flickering in RecyclerView at each time that bindViewHolder is hit.
Please, look at this https://github.com/nostra13/Android-Universal-Image-Loader/wiki/Useful-Info for how enable caching using Universal Image Loader.
If it doesn't yet work well, I will need to create a small sample for analyse "Thread Windows" in Eclipse, looking for the Thread generating frequency.
@ppamorim If it doesn't yet work again, we'll have to pause the loading of images when scrolling the RecyclerView and an its items come out of the screen. When the item come back to the screen, we resuming the loading.
@HoracioFilho send me your Google Plus or Facebook account. I'll send the APK to show what's happening.
I will love it :smile:. Please, could you send me the apk via email? My email is hjcf@cin.ufpe.br.
Sent
Not working yet...
@HoracioFilho @lucasr ENG: From what I observed the problem seems to be related to the loading of items. The same problem occurs with AdView. It seems that the list moves when finished loading/update of image/banner, would it?
PT-BR: Pelo que observei o problema parece ser referente ao carregamento dos itens. Ocorre o mesmo problema com o AdView. Parece que a lista se move quando termina o carregamento/atualização da imagem/banner, seria isso?
Detected : The problem only occurs with the UIL(and bug all views), with Picasso ImageLoader work perfectly without any bug.
NOT! IGNORE IT.
We get this same problem with Picasso.
@Override
public void onBindViewHolder(final ViewHolder holder, int position) {
DemoEntity demoEntity = demoList.get(position);
holder.textView.setText(demoEntity.text);
long time = System.currentTimeMillis();
loadImage(holder, demoEntity);
Log.d("LOGTAG", "time to load image:" + (System.currentTimeMillis() - time));
}
private void loadImage(final ViewHolder holder, DemoEntity demoEntity) {
Picasso.with(holder.imageView.getContext())
.load(demoEntity.imageDrawable)
.transform(transformation)
.into(holder.imageView);
}
The time to load images is at most 15 milliseconds
I've dig into library and found out that ImageView
image loading causes onLayoutChildren
to be called. This method has bug in it, which leads us to scroll to beginning of first visible item nearly every time.
You can try https://github.com/lucasr/twoway-view/pull/167 to fix it
I also see that setting the imageview asynchronously, via Picasso or via a post(Runnable) gives this issue...
any one solved this issue? facing the same problem!
Even with this problem? WHY?!
I'm using regular RecyclerView/LayoutManager with Glide, also seeing this issue. Feels like it is RecyclerView bug and not image loader.
I looked a little bit into this issue, looks like when you refresh data RecyclerView will get you a new ViewHolder, while old ListView/GridView and other AbsListView, reused exactly the same holder, making flickers "invisible".
issues was fixed when change one line of code. and tried with Picasso no flicker
Open layout folder of library. Browse the package org.lucasr.twowayview.widget Open BaseLayoutManager class Jump to Line no. 362 You will found code as
if (anchorItemPosition > 0 && (refreshingLanes || !restoringLanes)) {
replace this line by this one
if (anchorItemPosition > 0 && refreshingLanes && !restoringLanes) {
@iamvijayakumar workaround is right for me. I don't know if it has any side effect o not, but thank you. It's awesome.
Thank you @christian
@iamvijayakumar It works!!! THANKS!
Hello , my list is very bizarre . If you disable image loader (UIL) , the list flowing normal. Ever turn , the list is moving alone and flicking . Does anyone have any idea what it might be?
Sample: https://drive.google.com/file/d/0BwCQLXhzKWGUd2Y0YjF0dWZ3dkE/view?usp=sharing