0

I understand that we can use the methods notifyDataSetChanged() to add new elements to the recyclerview and update the view, but I need the transition to be smooth.

When I tried using a Transition with a LinearInterpolator, I could achieve the effect, but the scroll automatically jumps to the last position of the updated list and I need to avoid that.

moreButtonClicked(){
                viewMore.setVisibility(View.GONE);
                rcAdapter.moreClicked = true;
                rcAdapter.notifyDataSetChanged();
                Transition changeBounds = new ChangeBounds();
                changeBounds.setDuration(3000);
                changeBounds.setInterpolator(new LinearInterpolator() );
                TransitionManager.beginDelayedTransition(myCityList,changeBounds);
}

This code makes it autoscroll to the last item of the recyclerview. The other thing about this problem is that it happens only sometimes. I need to mention that my recyclerview is within a Nestedscrollview

Harsha Vardhan
  • 446
  • 4
  • 15

1 Answers1

0

I just figured the solution, I just needed to put android:descendantFocusability="blocksDescendants" on the layout inside the NestedScrollView which helped me get rid of this issue.

Thanks to this post which helped me get rid of this issue NestedScrollView scroll down itself when content is fills

Harsha Vardhan
  • 446
  • 4
  • 15