Skip to content

Commit ede1bdc

Browse files
kendrickumstattdimhappi
authored andcommitted
[Button][SplitButton] Updated XML for split button examples in documentation for improved accuracy.
PiperOrigin-RevId: 744726260
1 parent 44eabe3 commit ede1bdc

File tree

1 file changed

+62
-18
lines changed

1 file changed

+62
-18
lines changed

docs/components/Button.md

Lines changed: 62 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -768,26 +768,70 @@ trailing icon button that has an AnimatedVectorDrawable.
768768
In the layout:
769769

770770
```xml
771-
<com.google.android.material.button.MaterialSplitButton
772-
xmlns:android="http://schemas.android.com/apk/res/android"
773-
xmlns:app="http://schemas.android.com/apk/res-auto"
774-
android:id="@+id/splitbutton"
775-
android:layout_width="wrap_content"
776-
android:layout_height="wrap_content">
771+
<com.google.android.material.button.MaterialSplitButton
772+
android:id="@+id/splitbutton"
773+
android:layout_width="wrap_content"
774+
android:layout_height="wrap_content">
775+
<Button
776+
android:layout_width="wrap_content"
777+
android:layout_height="wrap_content"
778+
android:paddingTop="6dp"
779+
android:paddingBottom="6dp"
780+
android:paddingStart="@dimen/m3_comp_split_button_small_leading_button_leading_space"
781+
android:paddingEnd="@dimen/m3_comp_split_button_small_leading_button_trailing_space"
782+
android:minWidth="@dimen/mtrl_min_touch_target_size"
783+
android:text="@string/cat_split_button_label"
784+
app:icon="@drawable/ic_edit_vd_theme_24dp"
785+
app:iconSize="20dp"
786+
/>
787+
<Button
788+
style="?attr/materialSplitButtonIconFilledStyle"
789+
android:id="@+id/expand_more_or_less_filled"
790+
android:layout_width="wrap_content"
791+
android:layout_height="wrap_content"
792+
android:paddingStart="14dp"
793+
android:paddingEnd="14dp"
794+
android:minWidth="@dimen/mtrl_min_touch_target_size"
795+
android:contentDescription="@string/cat_split_button_label_chevron"
796+
app:icon="@drawable/m3_split_button_chevron_avd"
797+
/>
798+
</com.google.android.material.button.MaterialSplitButton>
799+
```
800+
801+
The following example shows a split button with a leading icon button and a
802+
trailing icon button that has an AnimatedVectorDrawable.
803+
804+
In the layout:
805+
806+
```xml
807+
<com.google.android.material.button.MaterialSplitButton
808+
android:id="@+id/splitbutton"
809+
android:layout_width="wrap_content"
810+
android:layout_height="wrap_content">
777811
<Button
778-
android:layout_width="wrap_content"
779-
android:layout_height="wrap_content"
780-
android:text="@string/split_button_label"
781-
app:icon="@drawable/ic_edit_vd_theme_24dp"/>
812+
android:layout_width="wrap_content"
813+
android:layout_height="wrap_content"
814+
android:paddingTop="6dp"
815+
android:paddingBottom="6dp"
816+
android:paddingStart="@dimen/m3_comp_split_button_small_leading_button_leading_space"
817+
android:paddingEnd="@dimen/m3_comp_split_button_small_leading_button_trailing_space"
818+
android:minWidth="@dimen/mtrl_min_touch_target_size"
819+
android:contentDescription="@string/cat_split_button_label_edit"
820+
app:icon="@drawable/ic_edit_vd_theme_24dp"
821+
app:iconSize="20dp"
822+
app:iconPadding="0dp"
823+
/>
782824
<Button
783-
style="?attr/materialSplitButtonIconFilledStyle"
784-
android:id="@+id/expand_more_or_less"
785-
android:layout_height="wrap_content"
786-
android:layout_width="wrap_content"
787-
android:minWidth="48dp"
788-
android:gravity="center"
789-
android:contentDescription="@string/split_button_label_chevron"
790-
app:icon="@drawable/m3_split_button_chevron_avd"/>
825+
style="?attr/materialSplitButtonIconFilledStyle"
826+
android:id="@+id/expand_more_or_less_filled_icon"
827+
android:layout_width="wrap_content"
828+
android:layout_height="wrap_content"
829+
android:paddingStart="14dp"
830+
android:paddingEnd="14dp"
831+
android:minWidth="@dimen/mtrl_min_touch_target_size"
832+
android:contentDescription="@string/cat_split_button_label_chevron"
833+
app:icon="@drawable/m3_split_button_chevron_avd"
834+
/>
791835
</com.google.android.material.button.MaterialSplitButton>
792836
```
793837

0 commit comments

Comments
 (0)