Android examples for User Interface:View Enable
set View Enabled Recursive
// Licensed under the Apache License, Version 2.0 (the "License"); import android.view.View; import android.view.ViewGroup; public class Main{ private final static String TAG = ""; private final static boolean VERBOSE = false; public static void setEnabledRecursive(ViewGroup viewGroup, boolean enabled) { Log.vc(VERBOSE, TAG, "setEnabledRecursive: viewGroup=" + viewGroup + ", enabled=" + enabled); final int children = viewGroup.getChildCount(); for (int i = 0; i < children; i++) { View view = viewGroup.getChildAt(i); view.setEnabled(enabled);/*w w w . jav a2 s. c o m*/ if (view instanceof ViewGroup) { setEnabledRecursive((ViewGroup) view, enabled); } } } }