material-components-android icon indicating copy to clipboard operation
material-components-android copied to clipboard

[ButtonToggleGroup] Disabling ToggleGroup doesn't disable child buttons

Open patzly opened this issue 3 years ago • 0 comments
trafficstars

Description: Hi, I think this is not a bug but a logical improvement: when I use setEnabled(false) to disable a MaterialButtonToggleGroup, nothing happens.

Expected behavior: For me the logical behavior would be to have all child buttons disabled at once. For now I had to call setEnabled(false) on every child button seperately instead of simply call it on the container.

Source code:

<com.google.android.material.button.MaterialButtonToggleGroup
    android:id="@+id/toggle_group"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    app:singleSelection="true"
    app:selectionRequired="true">

    <com.google.android.material.button.MaterialButton
        android:id="@+id/button_on"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="On" />

    <com.google.android.material.button.MaterialButton
        android:id="@+id/button_off"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Off" />

</com.google.android.material.button.MaterialButtonToggleGroup>
binding.toggleGroup.setEnabled(false);

Android API version: 33

Material Library version: 1.8.0-alpha01

Device: Pixel 6

patzly avatar Sep 07 '22 22:09 patzly