How to write custom ExpandableListAdapter

前端 未结 4 730
梦如初夏
梦如初夏 2020-12-02 19:45

I\'m looking to write my own ExpandableListAdapter which operates similarly to ArrayAdapter. My data model is this:

public class Gr         


        
4条回答
  •  Happy的楠姐
    2020-12-02 19:52

    I was fairly surprised I didn't find better documentation on this either. If you find one, please post it here. The best implementation example I found was in ApiDemos. There is an ExpandableListActivity that implements a BaseExpandableListAdapter. The class is called ExpandableList1.java.

    You will have to create your own add() method that adds your Group and Child classes to the adapter. I don't think it will be that difficult at first glance. In fact you might just be able to create the references to the class objects. When I implemented mine, my data set was small and didn't change so I only needed to refer to my array.xml file.

提交回复
热议问题