views:

374

answers:

2

I have a listview with tickboxes, which uses an Adapter and which works well.

And I know how to make a whole list expandable.

But, it it possible to have just a single item expandable, or does it have to be the whole list?? If so, how is it done?

A: 

You would need to use Lists of one item each. Unfortunately there is no SDK widget that handles the special case you need.

Dylan McClung
A: 

You can insert (or remove) the 'child' items in the right place within your adapter's data set when the 'parent' is clicked using a normal ListView.

adamp
I don't think you can use a child view with an ArrayAdapter, or am I wrong?
andy_spoo
Is it possible to have 2 ListViews, with one ListView 'stuck' to the bottom of the other, so they scroll together and look as if they are one?
andy_spoo
@andy_spoo To create a 'child' view you could insert/remove an adapter item at position N+1 when the parent is clicked where position N is your parent. ArrayAdapter assumes a single item type and may not be appropriate for this depending on your data.To the second question: you could probably hack something together but the cleanest way to accomplish the effect would be to create a composite adapter that aggregates items from two or more adapters using a single ListView. Make sure item types are unique across the aggregated adapters.
adamp