Example usage for android.view ViewGroup setActivated

List of usage examples for android.view ViewGroup setActivated

Introduction

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

Prototype

public void setActivated(boolean activated) 

Source Link

Document

Changes the activated state of this view.

Usage

From source file:de.mrapp.android.validation.AbstractValidateableView.java

/**
 * Adapts the activated state of all children of a specific view group.
 *
 * @param viewGroup//from  ww w. j  av  a  2s  . c om
 *         The view group, whose children's activated states should be adapted, as an instance
 *         of the class {@link ViewGroup}. The view group may not be null
 * @param activated
 *         True, if the children should be activated, false otherwise
 */
private void setActivatedOnViewGroup(@NonNull final ViewGroup viewGroup, final boolean activated) {
    viewGroup.setActivated(activated);

    for (int i = 0; i < viewGroup.getChildCount(); i++) {
        View child = viewGroup.getChildAt(i);

        if (child instanceof ViewGroup) {
            setActivatedOnViewGroup((ViewGroup) child, activated);
        } else {
            child.setActivated(activated);
        }
    }
}