code: private void enableDisableView(View view, boolean enabled) {
          view.setEnabled(enabled);
          view.setFocusable(enabled);
          if (view instanceof ViewGroup) {
              ViewGroup group = (ViewGroup) view;
  
              for (int idx = 0; idx < group.getChildCount(); idx++) {
                  enableDisableView(group.getChildAt(idx), enabled);
              }
          }
      }
docs: helper method to disable a view and all its subviews
  
  @param view
  @param enabled