title: How to programmatically set the margin between icon and title of menu item of Navigation Drawer in Android?
body: <p>I am developing an Android App. In my app, I am using navigation drawer and navigation view. But I set the menu item for them programmatically. For a menu item, I set both icon and title. But I am having a problem with that. That is I cannot set the spacing between icon and title that I programmatically added to menu. </p>
  
  <p>This is how I programmatically add item to menu</p>
  
  <pre><code>Menu menu = leftDrawer.getMenu();
          SubMenu subMenu = menu.addSubMenu(MAIN_MENU_ITEM_GROUP_ID, 99, 99, "Others");
  
          subMenu.add(MAIN_MENU_ITEM_GROUP_ID,96,96,"Monthly Leaderboard").setIcon(R.drawable.leaderboard_icon).setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
              @Override
              public boolean onMenuItemClick(MenuItem item) {
                  startActivity(new Intent(MainActivity.this, LeaderboardActivity.class));
                  return false;
              }
          });
  
          subMenu.add(MAIN_MENU_ITEM_GROUP_ID,96,96,"Settings").setIcon(R.drawable.settings_icon).setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
              @Override
              public boolean onMenuItemClick(MenuItem item) {
                  startActivity(new Intent(MainActivity.this, SettingsActivity.class));
                  return false;
              }
          });
  </code></pre>
  
  <p>But spacing between between icon and title is not properly set.</p>
  
  <p>This is the screenshot of my problem</p>
  
  <p><a href="https://i.stack.imgur.com/mkhmU.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/mkhmU.png" alt="enter image description here"></a></p>
  
  <p>As you can see in screenshot, spacing between left side of screen and icon and spacing between icon and title are not same. How can I set the spacing between icon and title of menu item programmatically?</p>