List of usage examples for android.view ViewGroup getChildAt
public View getChildAt(int index)
From source file:Main.java
public static void disableAllChildren(View view) { if (view instanceof ViewGroup) { ViewGroup viewGroup = (ViewGroup) view; for (int i = 0; i < viewGroup.getChildCount(); i++) { View child = viewGroup.getChildAt(i); child.setEnabled(false);/*from ww w . ja v a 2 s . com*/ disableAllChildren(child); } } }
From source file:Main.java
/** * Set typeface for a viewgroup/*from ww w .j av a2s .c o m*/ * * @param typeFace * @param parent */ public static void setTypeFace(Typeface typeFace, ViewGroup parent) { for (int i = 0; i < parent.getChildCount(); i++) { View v = parent.getChildAt(i); if (v instanceof ViewGroup) setTypeFace(typeFace, (ViewGroup) v); else if (v instanceof TextView) setTypeFace(typeFace, (TextView) v); } }
From source file:Main.java
public static int findChildIndex(ViewGroup parent, View child) { int count = parent.getChildCount(); for (int i = 0; i < count; ++i) { if (parent.getChildAt(i) == child) { return i; }//w ww .j ava2 s . c o m } return -1; }
From source file:Main.java
public static void findAllViews(ViewGroup parent, List<View> views, Class type) { for (int i = 0; i < parent.getChildCount(); i++) { View child = parent.getChildAt(i); if (child instanceof ViewGroup && child.getClass() != type) { findAllViews((ViewGroup) child, views, type); } else if (child != null) { if (child.getClass() == type) { views.add(child);//from w w w.j a va 2 s . c o m } } } }
From source file:Main.java
public static View getRootView(Activity context) { if (context == null) return null; ViewGroup content = (ViewGroup) context.findViewById(android.R.id.content); if (content != null) { return content.getChildAt(0); }//from w w w. j a va2 s. c o m return null; }
From source file:Main.java
public static void showMessage(ViewGroup emptyView, String msg) { if (emptyView == null) { return;// w w w.j ava2s .c o m } ProgressBar pbLoading = (ProgressBar) emptyView.getChildAt(0); pbLoading.setVisibility(View.GONE); TextView tvEmptyMsg = (TextView) emptyView.getChildAt(1); tvEmptyMsg.setVisibility(View.VISIBLE); tvEmptyMsg.setText(msg); }
From source file:Main.java
private static void processsViewGroup(ViewGroup v, final int len) { for (int i = 0; i < len; i++) { final View c = v.getChildAt(i); if (c instanceof TextView) { setCustomFont((TextView) c); } else if (c instanceof ViewGroup) { setCustomFont((ViewGroup) c); }/* w w w .j a v a 2 s.com*/ } }
From source file:com.nkahoang.screenstandby.BaseActivity.java
protected static void SetMetroFont(ViewGroup layout) { for (int i = 0; i < layout.getChildCount(); i++) { TextView text = (layout.getChildAt(i) instanceof TextView ? (TextView) layout.getChildAt(i) : null); if (text != null) text.setTypeface(typeface);/*w w w . j a v a 2s . c om*/ } }
From source file:Main.java
public static void setFontAllView(ViewGroup vg) { for (int i = 0; i < vg.getChildCount(); ++i) { View child = vg.getChildAt(i); if (child instanceof ViewGroup) { setFontAllView((ViewGroup) child); } else if (child != null) { Typeface face;//from w ww . j a v a2s . c o m if (child.getTag() != null && child.getTag().toString().toLowerCase().equals("bold")) { face = boldFont; } else { face = regularFont; } if (child instanceof TextView) { TextView textView = (TextView) child; textView.setTypeface(face); } else if (child instanceof EditText) { EditText editView = (EditText) child; editView.setTypeface(face); } else if (child instanceof RadioButton) { RadioButton radioView = (RadioButton) child; radioView.setTypeface(face); } else if (child instanceof CheckBox) { CheckBox checkboxView = (CheckBox) child; checkboxView.setTypeface(face); } else if (child instanceof Button) { Button button = (Button) child; button.setTypeface(face); } } } }
From source file:Main.java
protected static void makeMultiline(View view) { if (view instanceof ViewGroup) { ViewGroup grp = (ViewGroup) view; for (int index = 0; index < grp.getChildCount(); index++) { makeMultiline(grp.getChildAt(index)); }/*from w w w. j a v a 2 s . c o m*/ } else if (view instanceof TextView) { TextView t = (TextView) view; t.setSingleLine(false); t.setEllipsize(null); } }