I have a ListView with custom row layout. Basically right now they show two labels, but now I need to add a dynamically customView of ImageView + label in every single row. For example, I can have a row with 2 labels, a row with 2 labels + n*(ImageView + anotherLabel). How can I manage that?
Asked
Active
Viewed 96 times
2
-
`customView of ImageView + label` ... **OMG**!! why don't you simply use a TextView with a compound drawable inside? 1 standard control, no naive custom controls... – Phantômaxx Sep 05 '14 at 08:44
-
ok, but I can have 0,1,n of this in every single row, how can I add them dynamically? – Alessio Crestani Sep 05 '14 at 08:47
-
I think the closest thing to what you want to do is an `ExpandableListView`. – Phantômaxx Sep 05 '14 at 08:50
1 Answers
0
Extend BaseAdapter
and implement getView
which should return/reuse the correct View
type.
A really good tutorial to get started with BaseAdapter
can be found at http://www.piwai.info/android-adapter-good-practices/

Nova Entropy
- 5,727
- 1
- 19
- 32
-
I'm already doing this, but I can have 0, 1, n ImageView + Label to add, so I can add them to the xml layout, i need to add them dynamically. – Alessio Crestani Sep 05 '14 at 08:45