48

I have the following menu item:

<item
   android:id="@+id/lock"
   android:checkable="true"
   android:title="@string/lock" >
   <menu>
       <item
          android:id="@+id/block_mess"
          android:checked="true"
          android:icon="@drawable/chantinnhan"
          android:title="@string/block_mess_string" />
        <item
            android:id="@+id/block_call"
            android:checked="false"
            android:icon="@drawable/chancuocgoi"
            android:title="@string/block_call_string" />
        <item
            android:id="@+id/lock_app"
            android:checked="false"
            android:icon="@drawable/khoaungdung"
            android:title="@string/lock_app_string" />
   </menu>
</item>

...there's still more but it's really long

but the icon is really small (even it has res 256x256). I'd like to make it bigger! Is this possible?

Here's the screenshot:

enter image description here

EDIT: OK, we both know that Google "lock" the icon size. But I want to know that can I "bypass" that lock and make something... customizable?

Rohit Singh
  • 16,950
  • 7
  • 90
  • 88
Chris Maverick
  • 928
  • 1
  • 8
  • 18
  • any luck regarding this??? i m stuck also – Aman Verma Oct 02 '15 at 10:58
  • @AmanVerma still no luck, buddy :(( – Chris Maverick Oct 02 '15 at 11:00
  • Do we have any example app which has bigger icons than this size? Even Gmail has the same sized icons. What i've heard and read is that the navigationView follows the material design guidelines so the icon sizes match that guideline. – Abdullah Shoaib Oct 11 '15 at 17:45
  • I require big sized icons too but if we find one example app, maybe we can email the developer and get some knowledge. :) – Abdullah Shoaib Oct 11 '15 at 17:46
  • @AbdullahShoaib actually you can make a custom drawer. Not really good, but it's customizable. – Chris Maverick Oct 12 '15 at 01:31
  • Odds are, you can't. I don't know that for sure, but the NavigationView is a very specific design tool made by the Android dev team for a very specific use case, and likely not 100% customizable. – WoogieNoogie Oct 12 '15 at 02:13
  • @ChrisMaverick Yes, It can be customized, but will have to do a lot of work to bring back all the callbacks and UI effects currently being managed by the NavigationView. – Abdullah Shoaib Oct 12 '15 at 04:49
  • @ChrisMaverick If you've a sample sourcecode, please share. Or maybe some links. – Abdullah Shoaib Oct 12 '15 at 04:50
  • @AbdullahShoaib hope this can help: http://www.tutecentral.com/android-custom-navigation-drawer/ – Chris Maverick Oct 12 '15 at 04:57
  • @ChrisMaverick Have you found a solution yet? I know we can use custom views, but I just wanna know if there's an official way :D – Ralphilius Nov 07 '15 at 04:39
  • @Ralphilius there is no official way. Google is pretty strict: http://ux.stackexchange.com/questions/85080/material-design-icon-size-in-navigation-drawer – Chris Maverick Nov 07 '15 at 05:56
  • @ChrisMaverick Is it good to override private resource `design_navigation_icon_size` ? – Ralphilius Nov 07 '15 at 08:19
  • @Ralphilius can you really do that ? I'm not sure how it works. All I know is design_navigation_icon_size is in OS's framework. And different OSs have different frameworks – Chris Maverick Nov 07 '15 at 11:22
  • @ChrisMaverick Yes, you can do that. I have tested, but you should override other attributes too for better design. – Ralphilius Nov 07 '15 at 11:37
  • @Ralphilius there is still zero answer. But now I think you should make it "count++", sir – Chris Maverick Nov 07 '15 at 11:39
  • I think you should not put your icon in circle. And icon's size on mdpi should be 24x24 pixel (24dp). Otherwise, android resize them and your icons look bad. – Muzaffer Nov 10 '15 at 09:58
  • @wisemann it's not about bad icons or not, it's about "can we make it bigger than 24dp programmatically ?". I actually don't really care if they look bad or not – Chris Maverick Nov 10 '15 at 11:06
  • just use design_navigation_icon_size – Abhishek Apr 06 '16 at 06:48

5 Answers5

108

You can change the size of navigationView icon by overriding design_navigation_icon_size attribute. You can put it in dimens and because you're overriding a private attribute, you need to include tools:override="true"

<dimen name="design_navigation_icon_size" tools:override="true">40dp</dimen>
Amad Yus
  • 2,856
  • 1
  • 24
  • 32
24

In your xml file the shortest way is there is a property in NavigationView Just add it .

app:itemIconSize="12dp"

23

Got Solution

Make Below entry in dimens.

<dimen name="design_navigation_icon_size">48dp</dimen>
Abhishek
  • 3,348
  • 3
  • 15
  • 34
10

The main thing that decide the icon's size is the dimension:navigation_icon_size, have a look at the NavigationMenuItemView class:

 public NavigationMenuItemView(Context context, AttributeSet attrs, int defStyleAttr) {
    super(context, attrs, defStyleAttr);
    this.mIconSize = context.getResources().getDimensionPixelSize(dimen.navigation_icon_size);
}

so, we can just overide the property in our dimens file.

For example:

<dimen name="navigation_icon_size">48dp</dimen>

add that code in the dimens file, and you can find it's size changed.

Before:

enter image description here

After:

enter image description here

Paresh Mayani
  • 127,700
  • 71
  • 241
  • 295
Zuo VJ
  • 149
  • 1
  • 2
8

According to the the design document set by Google itself, icons should be set to 14sp. I suggest you abide by this recommendation, since this is a standard used throughout all apps. As you said, there are no apps which have large icons in the navigation drawer, as this is not the norm when developing a navigation drawer icon.

enter image description here

Michele La Ferla
  • 6,775
  • 11
  • 53
  • 79