Android examples for User Interface:View Hide Show
set View Group Visible
//package com.java2s; import android.view.View; import android.view.ViewGroup; public class Main { public static void setViewGroupVisible(ViewGroup group, boolean isVisible) { for (int i = 0; i < group.getChildCount(); i++) { View child = group.getChildAt(i); if (isVisible) child.setVisibility(View.VISIBLE); else// w w w . java 2s .c o m child.setVisibility(View.GONE); if (child instanceof ViewGroup) setViewGroupEnabled((ViewGroup) child, isVisible); } } public static void setViewGroupEnabled(ViewGroup group, boolean isEnabled) { for (int i = 0; i < group.getChildCount(); i++) { View child = group.getChildAt(i); child.setEnabled(isEnabled); if (child instanceof ViewGroup) setViewGroupEnabled((ViewGroup) child, isEnabled); } } }