Android examples for User Interface:View Click
All On Click Binder to View recursively
//package com.java2s; import android.view.View; import android.view.ViewGroup; public class Main { public static void deepOnClickBinder(View view, View.OnClickListener listener) { if (view == null) { return; }//from w w w. ja v a 2s .c o m view.setOnClickListener(listener); if (view instanceof ViewGroup) { for (int i = 0; i < ((ViewGroup) view).getChildCount(); ++i) { View v = ((ViewGroup) view).getChildAt(i); if (v instanceof ViewGroup) { deepOnClickBinder((ViewGroup) v, listener); } else { v.setOnClickListener(listener); } } } } }