2

Is there a solution to retrieve the index of the first and the last visible items on the screen in a GridView or a ListView???

I searched in developer documentation but there was nothing, and i just found an interface [AbsListView.OnScrollListener] with method [onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount)] that the second parameter give the first visible item that i want, but for last visible item there were nothing

hamid_c
  • 849
  • 3
  • 11
  • 29

2 Answers2

2

You can acces the last visible item on list or grid using ( firstVisibleItem + visibleItemCount ) - 1.

1

You can write a custom ScrollListener and setOnScrollListener to the listView.

Hope this link helps.

Community
  • 1
  • 1
Anitha Manikandan
  • 1,160
  • 7
  • 19