Disabling all child views inside the layout
Even though the answer is expected instead of using recursion I think the below code will do the trick.This is what I used to disbale it. I just passed parentlayout and whether to show or hide as a boolean parameter
private void disable(LinearLayout layout, boolean enable) {
for (int i = 0; i < layout.getChildCount(); i++) {
View child = layout.getChildAt(i);
child.setEnabled(enable);
if (child instanceof ViewGroup) {
ViewGroup group = (ViewGroup) child;
for (int j = 0; j < group.getChildCount(); j++) {
group.getChildAt(j).setEnabled(enable);
}
}
}
Because your layouts are so heavily nested, you need to recursively disable the views. Instead of using your method, try something like this:
private static void disable(ViewGroup layout) {
layout.setEnabled(false);
for (int i = 0; i < layout.getChildCount(); i++) {
View child = layout.getChildAt(i);
if (child instanceof ViewGroup) {
disable((ViewGroup) child);
} else {
child.setEnabled(false);
}
}
}
then call:
disable(content_view);