Android examples for User Interface:View Child
get ViewGroup Child
/**// w w w .j av a2 s . c o m * (c) Winterwell Associates Ltd, used under MIT License. This file is background IP. */ //package com.java2s; import android.view.View; import android.view.ViewGroup; public class Main { public static <X extends View> X getChild(ViewGroup row, Class<X> klass) { assert klass != null; for (int i = 0; i < row.getChildCount(); i++) { View child = row.getChildAt(i); if (klass.isAssignableFrom(child.getClass())) { return klass.cast(child); } if (child instanceof ViewGroup) { X kid = getChild((ViewGroup) child, klass); if (kid != null) return kid; } } // fail return null; } }