我在android中有对象列表。我想遍历列表并创建一个可扩展的列表视图,每个对象一个条目。我已经ExpandableListView
在xml文件中创建了。所以我知道我从开始:
ExpandableListView results = ((ExpandableListView)rootView.findViewById(R.id.results));
我想遍历对象列表并Parent
为每个对象创建一个,每个对象Child
将是主对象的一个实例变量。
例如:
Parent = Object.Title
Child1 = Object.Taste
Child2 = Object.smell
Parent1 = Object1.Title
Child1 = Object1.Taste
Child2 = Object1.smell
您需要创建对其进行扩展的适配器,BaseExpandableListAdapter
以管理子视图和父视图。看到此了解详情。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句