Android examples for User Interface:RecyclerView
get first visible position of recycler view
import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.RecyclerView; public class Main{ /**//w ww .j ava 2s. com * get first visible position of recycler view * * @param rv * @return */ public static int getFirstVisiblePosition(RecyclerView rv) { if (rv != null) { final RecyclerView.LayoutManager layoutManager = rv .getLayoutManager(); if (layoutManager instanceof LinearLayoutManager) { return ((LinearLayoutManager) layoutManager) .findFirstVisibleItemPosition(); } } return 0; } }