Android examples for User Interface:ViewGroup
get All Children from ViewGroup
//package com.java2s; import java.util.ArrayList; import java.util.List; import android.view.View; import android.view.ViewGroup; public class Main { public static List<View> getAllChildren(ViewGroup top) { List<View> children = new ArrayList<View>(); for (int i = 0; i < top.getChildCount(); i++) { View child = top.getChildAt(i); children.add(child);//from ww w . j a v a2 s . co m if (child instanceof ViewGroup) children.addAll(getAllChildren((ViewGroup) child)); } return children; } }