I have a ListView
with custom Adapter
. To be honest, I have many of them at the same time on screen, and my Tegra 3 device started to lag, what made me really confused... I found than in each ListView
's Adapter
the getView()
method is called for all visible rows every time any animations runs on screen. That gives me like few hundreds of calls per second! Digging more, most of these calls are due to measure()
and onMeasure()
calls of ListView
s' parents, and - this is tke key - they are useless, because all the layouts of my ListView
s
have const size.
So my question is: how to eliminate these calls? Of course I want to leave proper calls alone (caused by adding items to Adapter
and notifyDataSetChanged()
).
I've tried almost anything, but either the whole list doesn't draw itself (when I overriden it's onMeasure()
and forced to returned const size without calling super.onMeasure()
) or stops updating at some time.
How you implemented the getView() method? If you implement it in the correct way there should be nearly no lagging.
Check out this really really good video:
As Romain said, work with it not against it. Best is to leave measure() alone and focus on your adapter.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With