set Enabled View Group - Android User Interface

Android examples for User Interface:View Enable

Description

set Enabled View Group

Demo Code

import android.view.View;
import android.view.ViewGroup;

public class Main {
  public static void setEnabledViewGroup(ViewGroup viewGroup, boolean enable) {
    for (int i = 0; i < viewGroup.getChildCount(); i++) {
      View view = viewGroup.getChildAt(i);
      if (view instanceof ViewGroup) {
        setEnabledViewGroup((ViewGroup) view, enable);
      }//from   w  w  w.  j  av a 2  s.c o m
      view.setEnabled(enable);
      view.setClickable(enable);
    }
    viewGroup.setEnabled(enable);
    viewGroup.setClickable(enable);
  }
}

Related Tutorials