Example usage for android.view ViewGroup getChildCount

List of usage examples for android.view ViewGroup getChildCount

Introduction

In this page you can find the example usage for android.view ViewGroup getChildCount.

Prototype

public int getChildCount() 

Source Link

Document

Returns the number of children in the group.

Usage

From source file:Main.java

public static void makeChildrenInvisible(ViewGroup view) {
    for (int i = 0; i < view.getChildCount(); i++) {
        view.getChildAt(i).setVisibility(View.GONE);
    }/*from   w ww  .j  a v a 2  s .c o m*/
}

From source file:Main.java

public static View findLastChildView(ViewGroup group) {
    if (group != null && group.getChildCount() > 0)
        return group.getChildAt(group.getChildCount() - 1);
    return null;//from   w w w.  j  a  v  a 2s.co m
}

From source file:Main.java

public static void setChildrenAlpha(ViewGroup parent, float alpha) {
    for (int i = parent.getChildCount() - 1; i >= 0; --i) {
        parent.getChildAt(i).setAlpha(alpha);
    }/*from   www  .ja  v  a  2  s  .  c o m*/
}

From source file:Main.java

public static void stateControls(boolean able, ViewGroup vg) {
    for (int i = 0; i < vg.getChildCount(); i++) {
        View child = vg.getChildAt(i);
        child.setEnabled(able);/*ww w. j a  va 2 s.c om*/
        if (child instanceof ViewGroup) {
            stateControls(able, (ViewGroup) child);
        }
    }
}

From source file:Main.java

public static void dismissChildren(ViewGroup viewgroup) {
    int i1 = viewgroup.getChildCount();
    for (int j1 = 0; j1 < i1; j1++) {
        viewgroup.getChildAt(j1).setVisibility(4);
    }/*  ww  w .  j  a  v  a  2 s  .  c  om*/

    viewgroup.setVisibility(8);
}

From source file:Main.java

public static void showChildren(ViewGroup viewgroup) {
    int i1 = viewgroup.getChildCount();
    for (int j1 = 0; j1 < i1; j1++) {
        viewgroup.getChildAt(j1).setVisibility(0);
    }//from w w w .j ava2s .c o  m

    viewgroup.setVisibility(0);
}

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 w w  .  j av  a2s. c o  m
    }
    return -1;
}

From source file:Main.java

private static void makeHtml(ViewGroup viewGroup) {
    for (int i = 0; i < viewGroup.getChildCount(); i++) {
        final View childView = viewGroup.getChildAt(i);
        if (childView instanceof TextView) {
            final TextView curr = (TextView) childView;
            curr.setText(Html.fromHtml(curr.getText().toString()));
        }//from   w  w  w . j  a  v  a2s. c o m

        if (childView instanceof ViewGroup) {
            makeHtml((ViewGroup) childView);
        }
    }
}

From source file:Main.java

public static void addViewOnly(ViewGroup layout, View view) {
    try {/*ww w . j ava 2  s  .c om*/
        if (layout.getChildCount() > 0) {
            layout.removeAllViews();
        }
        layout.addView(view);
    } catch (Exception e) {
        // e.printStackTrace();
    }
}

From source file:Main.java

public static void addViewOnly(ViewGroup layout, View view) {
    try {/*from  w w w.  j ava2 s .co  m*/
        if (layout.getChildCount() > 0) {
            layout.removeAllViews();
        }
        layout.addView(view);
    } catch (Exception e) {
        e.printStackTrace();
    }
}