I use ExpandablerecyclerAdapater. Just want the screen to move up from align with parentItem clicked.
I altered the code to force collapse all items before I expand new one.
@Override
public void onParentListItemExpanded(int position) {
Object parent = mItemList.get(position);
collapseAllParents(); // Alternatively keep track of the single item that is expanded and explicitly collapse that row (more efficient)
expandParent(((ParentWrapper) parent).getParentListItem());
}
Now I`m doing in main activity
mAdapter.setExpandCollapseListener(new ExpandableRecyclerAdapter.ExpandCollapseListener() {
@Override
public void onListItemExpanded(final int position) {
mLayoutManager.scrollToPositionWithOffset(position, 0);
}
But it doesnt scroll. What I`m doing wrong?