I have a listview showing rows containing images from the web.
once a row needs to be drawn, in Adapter.getView(...)
, I download the image in the background and set it to the ImageView
in the UI thread. This means that the bitmap is being set into the ImageView in a delayed manner.
I tried the delayed setImage...() with simple drawable resources and the result was the same.
I observed that setting a resource in a delayed mannger, causes the whole list to be redrawn starting with position 0, which is not even shown - up to the shown position. The obvious problem is that the list scroll is slow and jumpy and not smooth.
I want to be extra careful here: This happens while scrolling a bit. The new seen items do get drawn as part of the regular makeAndAddView
. But, immediately after that all the rows leading up to the seen rows are being painted as part of measureHeightOfChildren
.
Setting the image immediately and not delayed does not cause the onMeasure
to be invoked.
So how do I prevent the repaint of all the list and why is the behavior different between the immediate setImage and the delayed?