Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to change the size of menu item icon in NavigationView?

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?

like image 281
Chris Maverick Avatar asked Aug 24 '15 09:08

Chris Maverick


People also ask

How do I change the icon size on my navigation drawer?

You can change the size of Navigation Drawer icons by overriding design_navigation_icon_size attribute in dimens. xml.


3 Answers

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>
like image 86
Amad Yus Avatar answered Oct 17 '22 18:10

Amad Yus


Got Solution

Make Below entry in dimens.

<dimen name="design_navigation_icon_size">48dp</dimen>
like image 23
Abhishek Avatar answered Oct 17 '22 18:10

Abhishek


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

app:itemIconSize="12dp"

like image 20
Jyotiprakash Das Avatar answered Oct 17 '22 18:10

Jyotiprakash Das