Remove space between menu icon and title

江枫思渺然 提交于 2019-12-11 04:24:50

问题


In the image below, how can I remove the space between the icon and the title of the item in the menu?

activity_main_drawer.xml:

<?xml version="1.0" encoding="utf-8" ?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">
    <item
        android:icon="@drawable/ic_exit_to_app"
        android:id="@+id/logout"
        android:title="Logout" />
</menu>

styles.xml:

<?xml version="1.0" encoding="utf-8" ?>
<resources>
    <style name="AppTheme" parent="Theme.AppCompat.Light">
        <item name="colorPrimary">@color/colorPrimary</item>
        <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
        <item name="colorAccent">@color/colorAccent</item>
    </style>
    <style name="AppTheme.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar" />
    <style name="AppTheme.LoginButton" />
    <style name="AppTheme.NoActionBar" parent="AppTheme">
        <item name="windowActionBar">false</item>
        <item name="windowNoTitle">true</item>
    </style>
    <style name="AppTheme.PopupOverlay" parent="ThemeOverlay.AppCompat.Light" />
</resources>

回答1:


You can play with those values overriding these values in your dimens.xml:

<dimen name="design_navigation_icon_padding" tools:override="true">10dp</dimen>

Though, it is not desirable to break material design guidelines.



来源:https://stackoverflow.com/questions/42889792/remove-space-between-menu-icon-and-title

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!