I have a question about RecyclerView.

Asked 1 years ago, Updated 1 years ago, 138 views

Hello, RecyclerView is showing you a list of lists. If you scroll down in RecyclerView, you'll see the items that are shown on the current screen I want to know which position item it is. I wonder if there is any method. Or I'd appreciate it if you could tell me which keywords to search for.

android recyclerview scroll-position

2022-09-22 21:35

1 Answers

If you are using Linear Layout Manager or Grid Layout Manager, the following functions can help you determine the position of the item currently displayed on the screen.

int findFirstVisibleItemPosition();
int findFirstCompletelyVisibleItemPosition();
int findLastVisibleItemPosition();
int findLastCompletelyVisibleItemPosition();

An example of the use of the above function can be viewed through the infinite scroll processing code in RecyclerView.


2022-09-22 21:35

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.