I'd like to use different row
descriptors (from the XML layout
resource) in one ListView. Can I and
how?
Step #1: Override your Adapter class and implement newView()
/bindView()
(or getView()
if ArrayAdapter
)
Step #2: Inflate the rows you want when you want them from the layouts you want
Step #3: Override getViewTypeCount()
and getItemViewType()
, returning appropriate values, so Android knows to use different object pools for each distinct type of row
This book excerpt covers #1 and #2, though for only one type of row. I don't have any samples handy for multiple types of rows, sorry.
Also, I'd like to be able to
programmatically change the size of
the rows, based on the data in each
row, in a ListView. Can I and how?
Put in bigger stuff in the row. Heights of rows are determined by their contents.