final int[] lastClickedPosition = {0};
expListView.setOnGroupClickListener(new ExpandableListView.OnGroupClickListener() {
@Override
public boolean onGroupClick(ExpandableListView parent, View v, int groupPosition, long id) {
Boolean shouldExpand = (!expListView.isGroupExpanded(groupPosition));

expListView.collapseGroup(lastClickedPosition[0]);

if (shouldExpand){
//generateExpandableList();
expListView.expandGroup(groupPosition);
expListView.setSelectionFromTop(groupPosition, 0);
}
lastClickedPosition[0] = groupPosition;

return true;
}
});

credit : http://stackoverflow.com/questions/12762958/auto-scrolling-in-expandablelistview

Android : Auto scrolling in ExpandableListView

Comments

comments

Tagged on: