List of usage examples for android.view ViewGroup getChildCount
public int getChildCount()
From source file:dev.drsoran.moloko.util.UIUtils.java
public final static Pair<Integer, Integer> getTaggedViewRange(ViewGroup container, String tag) { int tagStart = -1; int tagEnd = -1; final int cnt = container.getChildCount(); for (int i = 0; i < cnt && (tagStart == -1 || tagEnd == -1); ++i) { if (tagStart == -1 && tag.equals(container.getChildAt(i).getTag())) tagStart = i;/*from w ww .j av a2 s .co m*/ else if (tagStart != -1 && !tag.equals(container.getChildAt(i).getTag())) tagEnd = i; } if (tagStart != -1) return Pair.create(tagStart, tagEnd != -1 ? tagEnd : cnt); else return Pair.create(0, 0); }
From source file:am.widget.tabstrip.TabStripHelper.java
private static ViewPager traversal(View root) { if (root == null) return null; if (root instanceof ViewPager) { return (ViewPager) root; }/*from w ww.ja va 2s . c o m*/ if (root instanceof ViewGroup) { final ViewGroup group = (ViewGroup) root; final int count = group.getChildCount(); for (int i = 0; i < count; i++) { final ViewPager target = traversal(group.getChildAt(i)); if (target != null) { return target; } } } return null; }
From source file:li.barter.utils.Utils.java
/** * Test whether a viewgroup already contains a specific instance of a child view * * @param viewGroup//from www.j av a 2 s . c om * @param view * @return */ public static boolean containsChild(ViewGroup viewGroup, View view) { boolean contains = false; for (int i = 0; i < viewGroup.getChildCount(); i++) { if (viewGroup.getChildAt(i).equals(view)) { contains = true; break; } } return contains; }
From source file:edu.com.mvplibrary.ui.widget.StatusBarUtil.java
/** * ???/*from ww w . j a v a 2 s . c om*/ * * @param activity ? activity * @param statusBarAlpha ? */ private static void addTranslucentView(Activity activity, int statusBarAlpha) { ViewGroup contentView = (ViewGroup) activity.findViewById(android.R.id.content); // ??,?? if (contentView.getChildCount() > 1) { contentView.removeViewAt(1); } contentView.addView(createTranslucentStatusBarView(activity, statusBarAlpha)); }
From source file:org.solovyev.android.calculator.App.java
static <T> void processViewsOfType0(@Nonnull View view, @Nullable Class<T> viewClass, @Nonnull ViewProcessor<T> viewProcessor) { if (view instanceof ViewGroup) { final ViewGroup viewGroup = (ViewGroup) view; if (viewClass == null || viewClass.isAssignableFrom(ViewGroup.class)) { //noinspection unchecked viewProcessor.process((T) viewGroup); }/*from w ww . j av a2 s. co m*/ for (int index = 0; index < viewGroup.getChildCount(); index++) { processViewsOfType0(viewGroup.getChildAt(index), viewClass, viewProcessor); } } else if (viewClass == null || viewClass.isAssignableFrom(view.getClass())) { //noinspection unchecked viewProcessor.process((T) view); } }
From source file:com.vuze.android.remote.AndroidUtilsUI.java
public static ArrayList<View> findByClass(ViewGroup root, Class type, ArrayList<View> list) { final int childCount = root.getChildCount(); for (int i = 0; i < childCount; ++i) { final View child = root.getChildAt(i); if (type.isInstance(child)) { list.add(child);/* w w w . ja v a 2 s . c o m*/ } if (child instanceof ViewGroup) { findByClass((ViewGroup) child, type, list); } } return list; }
From source file:com.silentcircle.common.util.ViewUtil.java
/** * Sets state (enabled/disabled) for viewGroup and its children. * * @param viewGroup ViewGroup for which to set state. * @param enabled State to set./*from www .j a v a 2s .c o m*/ */ public static void setEnabled(final ViewGroup viewGroup, boolean enabled) { viewGroup.setEnabled(enabled); for (int i = 0; i < viewGroup.getChildCount(); i++) { View view = viewGroup.getChildAt(i); view.setEnabled(enabled); } }
From source file:com.transitionseverywhere.TransitionManager.java
private static boolean cancelAllSystemLayoutTransitions(View view) { boolean canceled = false; if (view instanceof ViewGroup) { ViewGroup viewGroup = (ViewGroup) view; canceled = ViewGroupUtils.cancelLayoutTransition(viewGroup); for (int i = 0; i < viewGroup.getChildCount(); i++) { canceled = cancelAllSystemLayoutTransitions(viewGroup.getChildAt(i)) || canceled; }//from ww w . j a v a 2s .c o m } return canceled; }
From source file:com.gosuncn.core.util.view.StatusBarUtils.java
@TargetApi(Build.VERSION_CODES.KITKAT) private static void clearPreviousSetting(Activity activity) { ViewGroup decorView = (ViewGroup) activity.getWindow().getDecorView(); int count = decorView.getChildCount(); if (count > 0 && decorView.getChildAt(count - 1) instanceof StatusBarView) { decorView.removeViewAt(count - 1); ViewGroup rootView = (ViewGroup) ((ViewGroup) activity.findViewById(android.R.id.content)) .getChildAt(0);/* w w w. ja va 2 s .co m*/ rootView.setPadding(0, 0, 0, 0); } }
From source file:com.gosuncn.core.util.view.StatusBarUtils.java
/** * ???/*w ww . j ava 2 s . c om*/ * * @param activity ? activity * @param statusBarAlpha ? */ private static void addTranslucentView(Activity activity, int statusBarAlpha) { ViewGroup contentView = (ViewGroup) activity.findViewById(android.R.id.content); if (contentView.getChildCount() > 1) { contentView.getChildAt(1).setBackgroundColor(Color.argb(statusBarAlpha, 0, 0, 0)); } else { contentView.addView(createTranslucentStatusBarView(activity, statusBarAlpha)); } }