Android: How Do I Return To To Top Of Recyclerview After Adding Item?
I have a RecyclerView list of CardViews. New CardViews are inserted at the top of the list. If the View is currently at the bottom of the CardView list and I click my 'Add' button
Solution 1:
do like this
recyclerview.post(newRunnable() {
@Overridepublicvoidrun() {
LinearLayoutManagerlayoutManager= (LinearLayoutManager) mRecyclerView.getLayoutManager();
layoutManager.scrollToPositionWithOffset(0, 0);
}
});
if this does not work check where are you calling this and control executes this statement or not.
Post a Comment for "Android: How Do I Return To To Top Of Recyclerview After Adding Item?"