set View Enabled State - Android User Interface

Android examples for User Interface:View Enable

Description

set View Enabled State

Demo Code


//package com.java2s;
import android.view.View;
import android.view.ViewGroup;

public class Main {
    public static void setViewEnabledState(View view, boolean enabled) {
        view.setEnabled(enabled);//from  w  w  w  .j ava2 s . co m

        if (view instanceof ViewGroup) {
            ViewGroup group = (ViewGroup) view;

            for (int idx = 0; idx < group.getChildCount(); idx++) {
                setViewEnabledState(group.getChildAt(idx), enabled);
            }
        }
    }
}

Related Tutorials