Android examples for android.view:ViewParent
find Parent View Holder Item View
import android.support.v7.widget.RecyclerView; import android.view.View; import android.view.ViewParent; public class Main{ public static View findParentViewHolderItemView(View v) { final ViewParent parent = v.getParent(); if (parent instanceof RecyclerView) { // returns the passed instance if the parent is RecyclerView return v; } else if (parent instanceof View) { // check the parent view recursively return findParentViewHolderItemView((View) parent); } else {//from w w w . j ava2s . co m return null; } } }