code: public static void setEnabledStateOnViews(View v, boolean enabled) {
      v.setEnabled(enabled);
  
      if (v instanceof ViewGroup) {
        final ViewGroup vg = (ViewGroup) v;
        for (int i = vg.getChildCount() - 1; i >= 0; i--) {
          setEnabledStateOnViews(vg.getChildAt(i), enabled);
        }
      }
    }
docs: Makes sure the view (and any children) get the enabled state changed.