i am developing an app that load data inside recyclerview, when i scroll to top of my recyclerview (position 0) i will load more data, after loading new data recyclerview position changed, but i want to set FirstVisibleItemPosition manually, is there any way to do this?
Asked
Active
Viewed 30 times
-1
-
you can use recyclerView.scrollToPosition(0) – Nha Phạm Thị May 22 '18 at 09:12
-
this is not my solution because when i scroll to position(x), then "X"is last visible item and i want X" to be first visible item in recyclerview. – Farrokh May 22 '18 at 09:29
-
[https://stackoverflow.com/questions/26875061/scroll-recyclerview-to-show-selected-item-on-top] did you try? – Nha Phạm Thị May 23 '18 at 01:29
-
@NhaPhạmThị yes itried,but not work what i need – Farrokh May 24 '18 at 07:05
1 Answers
0
i solved the problem by this solution
when i add some data to my adapter, i called
adapter.notifyItemRangeChanged(...);
that was wrong.then i changed it to
adapter.notifyItemInserted(...)
and now it works.

Farrokh
- 1,167
- 1
- 7
- 18