/** * Loop among the views in the hierarchy and assign listener to them */ private void assignClickListenerRecursively(View parent) { if (parent == null) { return; } if (parent instanceof ViewGroup) { ViewGroup viewGroup = (ViewGroup) parent; int childCount = viewGroup.getChildCount(); for (int i = childCount - 1; i >= 0; i--) { View child = viewGroup.getChildAt(i); assignClickListenerRecursively(child); } } setClickListener(parent); }
assignClickListenerRecursively(view); assignClickListenerRecursively(headerView); holder.addHeader(headerView, fixedHeader); assignClickListenerRecursively(footerView); holder.addFooter(footerView, fixedFooter);