java - Retain scroll position in infinite RecycleView inside ScrollView (ANDROID) -
i have recycleview inside scrollview can infinite scroll , load new data paging. there way save scroll position (recycleview , scrollview) when activity onpause(), , restore when onresume(). instagram, facebook, etc. when click detail posting , timeline in same position when left beforeenter code here.
my advice : use recycleview inside recycleview. recycleview can use strategy : 1) save last visible item position 2) manipulations 3) restore position
int lastviewedposition = ((linearlayoutmanager)rv.getlayoutmanager()).findlastvisibleitemposition(); //some manipulations rv.getlayoutmanager().scrolltoposition(lastviewedposition + data.size() - 1);
Comments
Post a Comment