Android examples for User Interface:View Child
show All Children View Except
//package com.java2s; import android.view.View; import android.view.ViewGroup; public class Main { public static void showAllChildrenExcept(ViewGroup group, View... exceptions) { setVisibilityToAllChildrenExcept(group, View.VISIBLE, exceptions); }//from w w w . ja va2 s.c om public static void setVisibilityToAllChildrenExcept(ViewGroup group, int visibility, View... exceptions) { for (int i = 0; i < group.getChildCount(); i++) { View child = group.getChildAt(i); boolean shouldApplyVisibility = true; for (View exception : exceptions) { if (exception == child) { shouldApplyVisibility = false; break; } } if (shouldApplyVisibility) { child.setVisibility(visibility); } } } }