I need to use an expandable listview in my application, where each group has different Table Layouts. And i want to set onClick Listener to each rows in the table.
How is it possible to set different layouts to different groups in a expandable listview?
Or Is it possible to do the same function of Expandable listview with
Table Layout by dynamically adding rows(expanding) and removing them
(hiding).
You can create your own
ExpandableListAdapterbased on for exampleBaseExpandableListAdapter. Next you should override thegetChildViewmethod so the desired children would have a desired layout. Here’s a short example:If this answer is unclear I can provide you with the whole class, but examples are easy to find on the Web.
Here is the whole class from my project. I know that convertView should be reusable, but I had problem with the order of Views when the list was collapsed and then reopened. I had only several elements so it wasn’t a problem from performance perspective.
Here’s how it actually looks like: