Android中ExpandableListView,每次只展示一個分組

qingyezhu發表於2014-12-10
// 只允許開啟一個分組
        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);
                    }
                }
            }
        });

 

相關文章