Android 使用XML的可扩展列表

Android 使用XML的可扩展列表,android,xml,list,expandable,Android,Xml,List,Expandable,我的当前项目包含一个列表视图,其内容是xml中定义的字符串数组 setContentView(R.layout.contacts); String[] peoples = getResources().getStringArray(R.array.contacts); setListAdapter(new ArrayAdapter<String>(this, R.layout.list_item, peoples)); //uses the list_item.xml in the

我的当前项目包含一个列表视图,其内容是xml中定义的字符串数组

setContentView(R.layout.contacts);
String[] peoples = getResources().getStringArray(R.array.contacts);
setListAdapter(new ArrayAdapter<String>(this, R.layout.list_item, peoples));
//uses the list_item.xml in the layout folder.
getListView().setTextFilterEnabled(true);
setContentView(R.layout.contacts);
String[]peoples=getResources().getStringArray(R.array.contacts);
setListAdapter(新的ArrayAdapter(this,R.layout.list_项,peoples));
//使用布局文件夹中的list_item.xml。
getListView().setTextFilterEnabled(true);
这是一个非常简单、快速的公司联系人列表,只需修改xml即可添加新的联系人(我省略了电话号码的非智能逻辑,这并不重要)

但我想通过使用部门、职级等的可扩展列表来改进这一点。您可以通过这种方式打包更多信息,同时保持显示的可管理性


问题是我还没有找到任何方法来实现可扩展列表,其中父级和子级的数组是xml定义的字符串数组。任何人都有任何链接、建议、代码或项目符号吗?

我可能会侮辱你的智慧,或者你可能会撞到自己的头,但是你看过
ExpandableListView

吗?

是的,我看过,但是关于可扩展列表的所有内容要么是关于使用数据库连接填充数组,要么是关于硬编码。我会重读的。