how to change size of navigation view menu items and text?? How to change space between menu?
Asked Answered
S

4

9

I am making a sliding menu. I have successfully created a navigation drawer and menu items inside the navigation view in groups. But I want to make the items closer to each other. Can I change the spacing or size of items and text? Please help...

Smolt answered 3/9, 2015 at 18:3 Comment(0)
T
9

Create following Theme in your styles.xml for Navigation Drawer and you're done.

<style name="NavigationTheme" parent="AppTheme">
    <item name="android:textSize">16sp</item>
    <item name="android:layout_marginBottom">02dp</item>
</style>

Apply this theme to your navigation drawer layout

Thithia answered 30/11, 2015 at 12:22 Comment(1)
@Amrut can we reduce the distance between the icon and the text?Spellbinder
M
12

You can apply following Theme in your styles.xml for Navigation Drawer

<style name="NavigationTheme" parent="AppTheme">
    <item name="android:textSize">14sp</item>
    <item  name="android:textStyle">bold</item>
</style>

Apply this theme in Navigation Drawer

android:theme="@style/NavigationTheme"
Muscadine answered 3/9, 2015 at 18:7 Comment(1)
thank u for reply.. It works to change the text size. But how to make items closer to each other?? I want to change spacing between them.Smolt
T
9

Create following Theme in your styles.xml for Navigation Drawer and you're done.

<style name="NavigationTheme" parent="AppTheme">
    <item name="android:textSize">16sp</item>
    <item name="android:layout_marginBottom">02dp</item>
</style>

Apply this theme to your navigation drawer layout

Thithia answered 30/11, 2015 at 12:22 Comment(1)
@Amrut can we reduce the distance between the icon and the text?Spellbinder
P
2

The others solutions didn't worked for me, so I finally solved using the following theme:

<style name="NavigationTheme" parent="AppTheme">
    <item name="listPreferredItemHeightSmall">40dp</item>
</style>

And I applied it to the NavigationView:

<com.google.android.material.navigation.NavigationView
    android:theme="@style/NavigationTheme"
Polky answered 10/6, 2020 at 13:44 Comment(0)
R
0

add these line in navigation drawer layout of your xml file.

   <com.google.android.material.navigation.NavigationView

    app:itemVerticalPadding="10sp"/>
Rimini answered 24/3, 2023 at 11:44 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.