如何在NavigationView中更改菜单项图标的大小? [英] How to change the size of menu item icon in NavigationView?

查看:530
本文介绍了如何在NavigationView中更改菜单项图标的大小?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以下菜单项:

<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

,但图标确实很小(即使它的分辨率为256x256).我想把它做大!那可能吗? 这是屏幕截图:

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

好的,我们俩都知道Google锁定"了图标的大小.但是我想知道我可以绕过"那个锁并做一些可定制的事情吗?

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 ?

推荐答案

您可以通过覆盖design_navigation_icon_size属性来更改navigationView图标的大小.您可以将其放为变暗,并且由于您要覆盖私有属性,因此需要包含tools:override="true"

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>

这篇关于如何在NavigationView中更改菜单项图标的大小?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆