how to create multiple list view in android

♀尐吖头ヾ 提交于 2019-12-08 07:37:13

问题


How can I create multiple list views within a single activity? Each ListView should have a separated header which allows expanding or collapsing its list, and scrolling on any ListView should scroll the entire activity (NOT one scroll for first ListView and another for second ListView ONLY one scroll for BOTH ListView...)

listviews dynamically fills...

Here's a screenshot of a similar view:


回答1:


What you're describing is an ExpandableListView

The simplest way to create one is by changing your ListView in XML to ExpandableListView and use one of the implementations of ExpandableListAdapter like SimpleExpandableListAdapter or BaseExpandableListAdapter, which work similarly to their non-expandable versions.

Here's an example from the Android samples API which you can download using SDK Manager.



来源:https://stackoverflow.com/questions/18921786/how-to-create-multiple-list-view-in-android

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!