删除菜单图标和标题之间的空间 [英] Remove space between menu icon and title

查看:78
本文介绍了删除菜单图标和标题之间的空间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在下图中,如何删除菜单中图标和项目标题之间的空格?

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

<?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>

推荐答案

您可以使用覆盖

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.

这篇关于删除菜单图标和标题之间的空间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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