Here you can find the source of disableView(ViewGroup rootView, float alpha)
Parameter | Description |
---|---|
rootView | View to iterate in order to disable all its childs |
alpha | Alpha to set to disabled elements |
public static void disableView(ViewGroup rootView, float alpha)
//package com.java2s; //License from project: Open Source License import android.os.Build; import android.view.View; import android.view.ViewGroup; public class Main { /**/* w w w . j a v a 2s. com*/ * Disable all the childs of the selected root view * * @param rootView * View to iterate in order to disable all its childs * @param alpha * Alpha to set to disabled elements */ public static void disableView(ViewGroup rootView, float alpha) { int count = rootView.getChildCount(); View v; //Go over the child list of the view and disable all for (int i = 0; i < count; i++) { v = rootView.getChildAt(i); if (v != null) { if (v instanceof ViewGroup) disableView((ViewGroup) v, alpha); if (Build.VERSION.SDK_INT > Build.VERSION_CODES.FROYO) v.setAlpha(alpha); v.setEnabled(false); } } } }