KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I have a ListView that has a TextView and in each TextView several items, each with a brief description. In order to apply different styles to the items and description I am using multiples span objects: ClickableSpan , ForegroundColorSpan , BackgroundColorSpan , AbsoluteSizeSpan and StyleSpan . On average the ListView has 10 TextView s, and each TextView has 10 pairs of item/description and each pair uses around 6 SpanObject s so a total of ~600 SpanObject s per ListView . And when the user clicks one of the items the ListView is cleared and redraw again generating another set of 600 SpanObject s. So I am wondering if it would be a better idea to create one TextView for each item and each description and format it through XML rather than styling the TextView s with span, this way there would be around 200 TextView s and no SpanObject s. As a note, I did not start with this approach because the hierarchy tree of views was going to be more complex and TextView s are more expensive to create that the SpanObject s but now that I see the number of SpanObject s I am creating I am not sure what is better. I am also thinking to start writing a recycling mechanism but not sure if it is worth or this should not be a problem for Android GC.
Tags (comma-separated)
Save Edits
Cancel