我正在使用可扩展列表视图并使用expand.collapse将其折叠但是它抛出异常 - Arrayindexoutofbound。
ExpandableListView mExpandableList.setOnGroupClickListener(new OnGroupClickListener() {
@Override
public boolean onGroupClick(ExpandableListView parent, View v,
int groupPosition, long id) {
// TODO Auto-generated method stub
if(pause!=1234){
mExpandableList.collapseGroup(pause);
System.out.println(pause+" CLICKED");
}
pause=groupPosition;
return false;
}
});
答案 0 :(得分:0)
@Override
public boolean onGroupClick(ExpandableListView parent, View v,
int groupPosition, long id) {
// TODO Auto-generated method stub
if(pause!=1234){
mExpandableList.collapseGroup(groupPosition);
System.out.println(pause+" CLICKED");
}
pause=groupPosition;
return false;
}
或者如果它适合您的情况,请使用此方法。
mExpandableList.setOnGroupExpandListener(new OnGroupExpandListener() {
public void onGroupExpand(int groupPosition) {
}
});