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) {

    }
}

 

你可能感兴趣的:(Android)