1. 程式人生 > >RecyclerView中獲取顯示Item位置

RecyclerView中獲取顯示Item位置

if (mRecyclerView != null && mRecyclerView.getChildCount() > 0) {
    try {
        int currentPosition = ((RecyclerView.LayoutParams) mRecyclerView.getChildAt(0).getLayoutParams()).getViewAdapterPosition();
        Logger.i("currentPosition------------->" + currentPosition);
    } catch (Exception e) {

    }
}