问题
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