How to avoid re-drawing all views in an ArrayAdapter
I have an ArrayAdapter
powering a ListView
. I would like to change the data behind the ArrayAdapter
and update the ListView
's. Sounds like notifyDataSetChanged();
would be exactly what I am looking for, but it upda开发者_开发百科tes the entire ListView
, and I would prefer to update on a row-by-row basis.
Is there a way to do this with ArrayAdapter
, or do I need to manage my data some other way if I want this functionality?
It doesn't work like that, as far as I know.
It will only redraw the visible rows. This happens when you're scrolling anyway. If you're scrolling down, and one of your rows (a View) goes off the top, Android reuses it if possible when drawing rows that come into view from the bottom. This is what the 3rd parameter (convertView) of ListAdapter.getView() is for.
I'm pretty sure Android only draws the rows that you're able to see in any case.
精彩评论