问题
I need to show data which contains a main object and has many child objects. Each child object has its view which contains checkbox and buttons having functionality. Giving demo design which I've done
http://i.stack.imgur.com/ELB51.png
But am not understanding how to create nested listview to populate data in this way. Picture showing 'Reminder 01' is first reminder data and there will be many reminder data each having their own doses data with checkbox and snooze button. Even I've done all logic and getting data but don't know how to populate data in nested listview. Please give me efficient suggestion.
回答1:
You can use Cards Lib
Examples:
- Card With List
- Cardexpand-And-CardListView
And you can customize the card's internal layout to use according to what you need.
回答2:
You need an ExpandableListView backed by an ExpandableListAdapter. Here is a sample ExpandableListAdapter from an app that I worked on for practice sometime back (simply use it as an example as it was not designed with efficiency in mind) - Sample ExpandableListAdapter. You can go through the layouts to see how I used them.
You will go about the same as you would by binding a normal ListView to an instance class that extends BaseAdapter but instead you will bind your ExpandableListView to an instance of a class that extends BaseExpandableListAdapter.
来源:https://stackoverflow.com/questions/29306500/how-to-use-nested-listview-in-android