Skip to content

[button group] connected button groups affect adjacent buttons #4782

Closed
@manabu-nakamura

Description

@manabu-nakamura

Description: Connected button groups affect adjacent buttons.

video.mp4

Expected behavior: Connected button groups don't affect adjacent buttons.

https://m3.material.io/components/button-groups/guidelines:

Standard button groups ... When a button in a standard group is selected:

  • The selected button changes shape and width
  • A selected toggle button also changes color
  • Adjacent buttons move and temporarily change width

Connected button groups ...

They behave similarly to standard groups, except they don't affect adjacent buttons.

Source code: https://github.com/material-components/material-components-android/blob/master/docs/components/Button.md#connected-button-group:

<com.google.android.material.button.MaterialButtonGroup
    android:id="@+id/buttonGroup"
    style="@style/Widget.Material3.MaterialButtonGroup.Connected"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content">
    <Button
        style="?attr/materialButtonOutlinedStyle"
        android:id="@+id/button1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Button 1"
    />
    <Button
        style="?attr/materialButtonOutlinedStyle"
        android:id="@+id/button2"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Button 2"
    />
    <Button
        style="?attr/materialButtonOutlinedStyle"
        android:id="@+id/button3"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Button 3"
    />
</com.google.android.material.button.MaterialButtonGroup>

Minimal sample app repro: Test16.zip

Android API version: 34

Material Library version: 1.13.0-alpha13 and 1.14.0-alpha01

Device: Android Emulator 35.5.10

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions