2

I am using a custom menu in a navigation drawer. I would like to only reduce the left margin of the menu items and move the image view a little closer to margin (towards the left). I have already made the dimension changed for reducing the bottom margin and move the image view and text view.

<!-- Override the private variables in navigation drawer-->
    <dimen name="design_navigation_icon_size">45dp</dimen>
    <dimen name="design_navigation_icon_padding">5dp</dimen>
    <dimen name="design_navigation_separator_vertical_padding">0dp</dimen>
    <dimen name="design_navigation_seperator_left_margin">0dp</dimen>

enter image description here

I would only like to reduce the 16dp space for the image. Is there any dimension variable that can be over-ridden to do this ?

NavigatonView:

<android.support.design.widget.NavigationView
        android:id="@+id/nav_view"
        android:layout_width="wrap_content"
        android:layout_height="match_parent"
        android:layout_gravity="start"
        android:fitsSystemWindows="true"
        app:headerLayout="@layout/nav_header_main"
        app:itemIconTint="@null"
        app:menu="@menu/activity_main_drawer"
        app:itemTextAppearance="@style/NavigationDrawerStyle">

I have added

tools:override="true"

in the DrawerLayout.

The menu_drawer looks like this :

<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">

    <group android:id="@+id/grp1" android:checkableBehavior="single">
        <item
            android:id="@+id/navigation_item_1"
            android:icon="@drawable/menu_home_unselected"
            android:title="Home" />
    </group>

    <group android:id="@+id/grp2" android:checkableBehavior="single" >
        <item
            android:id="@+id/navigation_item_2"
            android:icon="@drawable/menu_identify"
            android:title="Identity" />
    </group>

    <group android:id="@+id/grp3" android:checkableBehavior="single" >
        <item
            android:id="@+id/navigation_item_3"
            android:icon="@drawable/menu_self_disclosure"
            android:title="Disclosure" />
    </group>
</menu>
thirtydot
  • 224,678
  • 48
  • 389
  • 349
Dinesh
  • 889
  • 14
  • 34
  • 1
    Can you show the relevant xml files, most importantly the drawer / navigation view ones. – Vucko Jul 21 '17 at 11:21
  • It's updated in the question now. – Dinesh Jul 21 '17 at 11:26
  • @USKMobility : The question you shared reduces the spacing at the bottom between the menu items. I am looking to reduce the space between the left margin and the menu item. I have also added the dimension changes mentioned there in my question too. I have the `18dp` in my styles file too. – Dinesh Jul 21 '17 at 11:29
  • 1
    define listPreferredItemPaddingLeft in your style same way and try –  Jul 21 '17 at 11:34
  • @USKMobility it worked ! :) Awesome answer. Can you make this as an answer ? – Dinesh Jul 21 '17 at 11:36

0 Answers0