jlhonora/multistatetogglebutton

Disabling the component

Closed this issue · 1 comments

Is there a way to disable the view like button.setEnabled(false) (This one isn't working) ?

Well I resolved it meanwhile. If anyone cares this is what I have done:

private static void setViewAndChildrenEnabled(View view, boolean enabled) {
    view.setEnabled(enabled);
    if (view instanceof ViewGroup) {
        ViewGroup viewGroup = (ViewGroup) view;
        for (int i = 0; i < viewGroup.getChildCount(); i++) {
            View child = viewGroup.getChildAt(i);
            setViewAndChildrenEnabled(child, enabled);
        }
    }
}

And then calling the method onto MultiStateToggleButton:

setViewAndChildrenEnabled(toggle,false);