I have a GridView with thumbnail images loaded in a separate thread. After all the thumbnails are done loading, if I scroll the grid view it's consistently slow (~5fps), until I scroll a few rows down, then it immediately scrolls extremely fast (~30fps) even if I scroll all the way up again.
If I then repopulate the gridview, it's slow again until I scroll down some more. It's not an issue of recycling the views as I am already doing that.
(Update: uploaded the correct slow trace image)
I tracked the issue to an internal view draw call. Here is the Android Studio trace for when it's slow:
And here is the trace for when it's fast:
It's clear the guilty method is android.view.ThreadedRenderer.draw()
, but this is an internal call and I can't test further. From the trace, my understanding is that it's not the drawing that is slow, as the android.view.ThreadedRenderer.updateRootDisplayList()
which eventually calls android.widget.AbsListView.draw()
finishes just as quickly in both traces. So it must be the rest of the android.view.ThreadedRenderer.draw()
that is causing this.
Looking online I found the ThreadedRenderer.java
class
Things I've tried:
Forcing hardware rendering on the gridview made no difference.
Forcing software rendering on the gridview made the list always scroll very slowly.
Any ideas why this could be happening?