开发者

Large number of TextViews a performance hit? Should I switch to ListView instead of using Scrollview?

开发者 https://www.devze.com 2023-03-10 21:23 出处:网络
So I have a screen that displays a grid (TableView where each TableRow is mostly TextViews) like a scorecard, with like 8 rows and 11 columns.

So I have a screen that displays a grid (TableView where each TableRow is mostly TextViews) like a scorecard, with like 8 rows and 11 columns.

I'd like to add about 10 more rows to it, and keep it in a ScrollView. But I'm wondering if I should switch the who开发者_开发技巧le thing to a ListView.

So assuming that half my grid is "off screen" is there a big performance (rendering time, memory usage) hit to just using the ScrollView? Or would I be better off going to a ListView?

Basically I just don't want the thing to lag when it displays the screen for the first time (or during scrolling).

Thanks.


I would use a ListView... It's so comfortable

With a ListView you can easily manage the selected rows. And with the right Adapter you can also write a very efficent List.

You can find a few examples in the Android API Demos


Using ListView and ListAdapter, there is a lot that is done under the hood to ensure that it is efficient, for example, the displayed list items are reused when scrolling rather than creating one for every item.

So yes, I would suggest using ListView along with ListAdapter.

0

精彩评论

暂无评论...
验证码 换一张
取 消