首页 > 代码库 > Android中ExpandableListView,每次只展示一个分组

Android中ExpandableListView,每次只展示一个分组

// 只允许打开一个分组        expandListView.setOnGroupExpandListener(new OnGroupExpandListener() {            @Override            public void onGroupExpand(int groupPosition) {                for (int i = 0, count = expandTreeViewAdapter.getGroupCount(); i < count; i++) {                    if (i != groupPosition) {                        expandListView.collapseGroup(i);                    }                }            }        });

 

Android中ExpandableListView,每次只展示一个分组