Android examples for User Interface:RecyclerView
get RecyclerView Adapter Position
import android.support.v7.widget.RecyclerView; import android.view.View; public class Main{ /*www .j a v a 2 s . co m*/ public static int getAdapterPosition(RecyclerView recyclerView, RecyclerView.ViewHolder holder) { RecyclerView.Adapter outerAdapter = recyclerView.getAdapter(); if (outerAdapter != null && outerAdapter instanceof MTFRecyclerViewAdapterWrapper) { int headerViewCounter = ((MTFRecyclerViewAdapterWrapper) outerAdapter) .getHeaderViewsCount(); if (headerViewCounter > 0) { return holder.getAdapterPosition() - headerViewCounter; } } return holder.getAdapterPosition(); } }