9

I know that it is not recommended to channge NavigationView item height.
But I need to decrease it a littl in order all items fit without scrolling.

I tried to create a style:

<style name="NavigationDrawerStyle">
        <item name="android:textSize">16sp</item>
        <item name="android:listPreferredItemHeight">30dp</item>
        <item name="android:listPreferredItemHeightLarge">30dp</item>
        <item name="android:listPreferredItemHeightSmall">30dp</item>
 </style>

And in layout add:

 app:theme="@style/NavigationDrawerStyle"

But it changes only font size and doesn't affect item height.

Androider
  • 407
  • 2
  • 7
  • 17
  • and i need to increase the height. – binaryKarmic Feb 05 '16 at 10:57
  • I found a tricky solution. Add to your dimens.xml 20dp try different values in dp to achieve the result you want – Androider Feb 05 '16 at 11:14
  • Won`t work :( i have overridden design_navigation_separator_vertical_padding to 0dp in order to show the item selection background to appear edge to edge when tapped. – binaryKarmic Feb 05 '16 at 11:28
  • Then If you consider external libs, you could use https://github.com/jfeinstein10/SlidingMenu and you are free to customize it as you want – Androider Feb 05 '16 at 11:32
  • Not really, rather using actionLayout would be convinient i guess. ref : http://stackoverflow.com/questions/30728842/how-can-i-add-a-custom-item-to-a-navigationview-with-a-menu-layout – binaryKarmic Feb 05 '16 at 11:45
  • 1
    check [this link](http://stackoverflow.com/questions/35313302/custom-menu-item-size-and-textsize-in-navigation-view) it may useful. – Prathap Badavath Oct 02 '16 at 09:12

1 Answers1

0

If You just want to change height of Navigation item you can add below line to your style.xml file

 <item name="listPreferredItemHeightSmall">60dp</item>

if you want to change item icon or title text you can use below lines in your dimen.xml file

<dimen name="design_navigation_padding_top_default" tools:override="true">5dp</dimen>
<dimen name="design_navigation_separator_vertical_padding" tools:override="true">0dp</dimen>
<dimen name="design_navigation_padding_bottom" tools:override="true">5dp</dimen>
<dimen name="design_navigation_icon_size" tools:override="true">20dp</dimen>
<dimen name="design_navigation_icon_padding" tools:override="true">50dp</dimen>

This works for me and hope will work for you too !