Answer the question
In order to leave comments, you need to log in
How to keep focus on an open ExpandableListview?
I have an ExpandableListview inside a NavigationDrawer. When opening a group, I close the previous open group, but when the group is closed, the open group loses focus (the position of the ExpandableListview goes down). Here is the code:
@Override
public boolean onGroupClick(ExpandableListView expandableListView, View view, int i, long l) {
if (mListView.isGroupExpanded(i)) {
mListView.collapseGroupWithAnimation(i);
} else {
mListView.expandGroupWithAnimation(i);
if(i!=lastExpandedGroupPosition )
mListView.collapseGroupWithAnimation(lastExpandedGroupPosition);
lastExpandedGroupPosition = i;
}
return true;
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question