I am trying to group an ArrayList
of event into a list of dates but have no idea how to achieve it.
My goal is to load the grouped data into an ExpandableListView
see image below.
I have a list of dates and a list of events too. So, I want to group the events objects into different days based on their date attributes.
You have to convert your data in the way ExpandableListAdapter
wants them.
Android has SimpleExpandableListAdapter
that can be used but this does not look even a little to the screen you provided. Just for reference here is an Example using such an adapter, so you get a point how it works.
If you want something exactly as the screen you provided you have to implement a custom expandable listiview with ExpandableListAdapter
by extending BaseExpandableAdapter
In case the items under the dates does not expand-collapse by pressing then I strongly sugest to look for a ListView with Section Headers the implementations is much easier.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.