Android examples for User Interface:View Child
Enables/Disables all child views in a view group.
//package com.java2s; import android.view.View; import android.view.ViewGroup; public class Main { /**// www .j a v a 2 s.c om * Enables/Disables all child views in a view group. * * @param viewGroup the view group * @param enabled <code>true</code> to enable, <code>false</code> to disable * the views. */ public static void enableDisableViewGroup(ViewGroup viewGroup, boolean enabled) { int childCount = viewGroup.getChildCount(); for (int i = 0; i < childCount; i++) { View view = viewGroup.getChildAt(i); view.setEnabled(enabled); if (view instanceof ViewGroup) { enableDisableViewGroup((ViewGroup) view, enabled); } } } }