I\'m currently working on a project in which I need something like the following:
- MainGroup 1 (Expandable)
- SubGroup 1 (Expandable)
- SubSubGroup 1
First of all, let me recommend you GrepCode site. It has sources of Android SDK classes. Thanks for them, I've found out base principles of AdapterViews (I gave you a link to ExpandableListView, but it's better if you research not only it, but its class-parents as well).
Now, your questions and my answers:
How and when is an ExpandableListView notified that a child is expanded/collapsed?
See method handleItemClick(View v, int position, long id)
How does the ExpandableListView know how much space to make for all children to fit into a group container?
I didn't research this question well, but as far as I know, it's made by the method requestLayout(). Also we found out that one scrollable View cannot be embedded into another scrollable View. (It's wide-known mistake: to put ListView into ScrollView or ListView into ExpandableListView).
How much benefit is there in using the ExpandableListView to create the above, compared to just mixing together my own solution using some LinearLayouts and some OnClickListeners?
AdapterViews are faster. But your construction is too complex even for ExpandableListView. You may use 2 solutions.