I want the things in the last expandable item to be fully visible when it is clicked,Now what is happening means when I click on last item it expands down, but I manually need to scroll up again to see the the things inside the expanded item.How can the last expandable item be fully visible. I am using Recyclerview.
Asked
Active
Viewed 1,869 times
2 Answers
3
I have found the solution which I wanted, I used
recyclerView.smoothScrollToPosition(selectedPosition);
after setting the adapter. So now the things in the last expandable item is fully visible when it is clicked.

Panther
- 3,312
- 9
- 27
- 50

Vineeth Holla
- 841
- 7
- 11
-
4How to determine selectedPosition? Is it a ParentItemIndex which has been clicked? please provide example – akshay bhange Aug 19 '17 at 15:50
0
Just a supplementary: If you use h6ah4i/advrecyclerview, you can use the following code snippet:
@Override
public boolean onHookGroupExpand(int groupPosition, boolean fromUser) {
// NOTE21: collapse all other groups when one item expand.
mExpMgr.collapseAll();
// NOTE21: Visibility of expanding last view in the expandable recyclerview
if (groupPosition == getGroupCount() - 1) {
mRecyclerView.smoothScrollToPosition(groupPosition + getChildCount(groupPosition));
}
return true;
}

Weiyi
- 1,843
- 2
- 22
- 34