Use scene: Disable all the child controls in the layout, so that the interface can only see, but can not edit, if a control to set up is certainly very troublesome, so think of a good method. You can extend more controls as needed, as long as you are aware that the control is ViewGroup type or view type.
The code is as follows:
/** * Traverse layout and Disable all child controls * * @param viewgroup * Layout object/public static void D Isablesubcontrols (ViewGroup viewgroup) {for (int i = 0; i < Viewgroup.getchildcount (); i++) {View v = viewgroup.
Getchildat (i);
if (v instanceof viewgroup) {if (v instanceof Spinner) {Spinner Spinner = (Spinner) v;
Spinner.setclickable (FALSE);
Spinner.setenabled (FALSE);
LOG.I (TAG, "A Spinner is unabled");
else if (v instanceof ListView) {(ListView) v). Setclickable (false);
((ListView) v). SetEnabled (false);
LOG.I (TAG, "A ListView is unabled");
else {disablesubcontrols ((viewgroup) v);
} else if (v instanceof edittext) {(edittext) v). SetEnabled (false);
((EditText) v). Setclickable (false);
LOG.I (TAG, "A EditText is unabled");
else if (v instanceof button) {(button) v). SetEnabled (false);
LOG.I (TAG, "A Button is unabled"); }
}
}