Skip to content

Commit 2439dc0

Browse files
imhappileticiarossi
authored andcommitted
[NavigationRail] Add label padding for when the label is long enough to reach the sides of the nav rail
PiperOrigin-RevId: 584069016
1 parent 144b515 commit 2439dc0

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

lib/java/com/google/android/material/navigationrail/res/layout/mtrl_navigation_rail_item.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,8 @@
5252
android:duplicateParentState="true"
5353
android:ellipsize="end"
5454
android:maxLines="1"
55+
android:paddingStart="@dimen/m3_navigation_rail_label_padding_horizontal"
56+
android:paddingEnd="@dimen/m3_navigation_rail_label_padding_horizontal"
5557
android:textSize="@dimen/mtrl_navigation_rail_text_size" />
5658
<TextView
5759
android:id="@id/navigation_bar_item_large_label_view"
@@ -61,6 +63,8 @@
6163
android:ellipsize="end"
6264
android:maxLines="1"
6365
android:textSize="@dimen/mtrl_navigation_rail_active_text_size"
66+
android:paddingStart="@dimen/m3_navigation_rail_label_padding_horizontal"
67+
android:paddingEnd="@dimen/m3_navigation_rail_label_padding_horizontal"
6468
android:visibility="invisible" />
6569
</com.google.android.material.internal.BaselineLayout>
6670
</merge>

lib/java/com/google/android/material/navigationrail/res/values/dimens.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,5 +37,6 @@
3737
<dimen name="m3_navigation_rail_item_active_indicator_width">@dimen/m3_comp_navigation_rail_active_indicator_width</dimen>
3838
<dimen name="m3_navigation_rail_item_active_indicator_height">@dimen/m3_comp_navigation_rail_active_indicator_height</dimen>
3939
<dimen name="m3_navigation_rail_item_active_indicator_margin_horizontal">4dp</dimen>
40+
<dimen name="m3_navigation_rail_label_padding_horizontal">2dp</dimen>
4041

4142
</resources>

0 commit comments

Comments
 (0)