Closed alashow closed 8 years ago
Hey @alashow, we don't precompute the positions. As you scroll, it's laid out on the fly, and the size calculations are cached, and returned on subsequent calls. Because of this, we don't know the last visible position ahead of time. Is there something you are specifically wanting to achieve?
@JVillella If you wish to implement an endless scroll listener you must know the LastVisibleItemPosition to make the necessary calculations. So is there any way to find out the last visible item ?
Hey @AngleV, no you don't, at least not explicitly. Up to you in regards to the implementation specifics, but what we have done is wrap a RecyclerView.OnScrollListener
within an RxJava PublishSubject
. In it's onScrolled()
we check if we are close to the edge using the total item count, the visible item count, and the first visible item index. If so, we notify the subscriber by via onNext(...)
.
How can i get last visible position? There is
findFirstVisibleItemPosition()
method, but no last visible position getter.