解决方法:需要重新一下onGroupClick
具体代码:
mListView.setOnGroupClickListener(new ExpandableListView.OnGroupClickListener() {
@Override
public boolean onGroupClick(ExpandableListView parent, View v, int groupPosition, long id) {
if(parent.isGroupExpanded(groupPosition)){
parent.collapseGroup(groupPosition);
}else{
//第二个参数false表示展开时是否触发默认滚动动画
parent.expandGroup(groupPosition,false);
}
//telling the listView we have handled the group click, and don't want the default actions.
return true;
}
});