Material Button Group
A common container for a set of related MaterialButtons. The MaterialButtons in this group will be shown on a single line.
This layout currently only supports child views of type MaterialButton. Buttons can be added to this view group via XML, as follows:
<com.google.android.material.button.MaterialButtonGroup
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/toggle_button_group"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<com.google.android.material.button.MaterialButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/button_label_private"/>
<com.google.android.material.button.MaterialButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/button_label_team"/>
<com.google.android.material.button.MaterialButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/button_label_everyone"/>
<com.google.android.material.button.MaterialButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/button_label_custom"/>
</com.google.android.material.button.MaterialButtonGroup>
Content copied to clipboard
Buttons can also be added to this view group programmatically via the addView methods.
MaterialButtonGroup is a LinearLayout. Using
android:layout_width="MATCH_PARENT" and removing android:insetBottom
android:insetTop on the children is recommended if using VERTICAL.
For more information, see the component developer guidance and design guidelines.
Inheritors
Types
Link copied to clipboard
A LinearLayout.LayoutParams implementation for MaterialButtonGroup.
Link copied to clipboard
The interface for the overflow mode attribute.
Link copied to clipboard
Class for common logic between this MaterialButtonGroup and the OverflowLinearLayout overflow features.
Properties
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
A value for
overflowMode.Link copied to clipboard
A value for
overflowMode.Link copied to clipboard
A value for
overflowMode.Link copied to clipboard
Functions
Link copied to clipboard
This override prohibits Views other than MaterialButton to be added.
Link copied to clipboard
Link copied to clipboard
Returns the original ShapeAppearanceModel for the MaterialButton child at the given index.
Link copied to clipboard
Returns the inner corner size of the group.
Link copied to clipboard
Returns the inner corner size state list of the group.
Link copied to clipboard
Returns the icon shown for the overflow button, if present.
Link copied to clipboard
Returns the ShapeAppearanceModel of the group.
Link copied to clipboard
Returns the StateListShapeAppearanceModel of the group.
Link copied to clipboard
Link copied to clipboard
Enables this MaterialButtonGroup and all its MaterialButton children
Link copied to clipboard
Sets the inner corner size of the group.
Link copied to clipboard
Sets the inner corner size state list of the group.
Link copied to clipboard
Link copied to clipboard
Sets the icon to show for the overflow button.
Link copied to clipboard
Sets the icon to show for the overflow button.
Link copied to clipboard
Sets the ShapeAppearanceModel of the group.
Link copied to clipboard
open fun setStateListShapeAppearance(@Nullable stateListShapeAppearance: StateListShapeAppearanceModel)
Sets the StateListShapeAppearanceModel of the group.