How can i remove the leftmost navigation drawer menu item on the Android Toolbar. Basically i wan\'t to contain 4 images in a horizontal fashion, Nothing else !
Use
yourActionBarDrawer.setDrawerIndicatorEnabled(false);
This will remove the hamburger icon on toolbar completely.
My solution:
DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(
this, drawer, toolbar, R.string.ACCEPT, R.string.CANCEL);
drawer.setDrawerListener(toggle);
toggle.syncState();
toggle.setDrawerIndicatorEnabled(false);
getSupportActionBar().setDisplayHomeAsUpEnabled(false)
This should remove the navigation drawer icon
Might be late but you can get the reference to the Toolbar:
Toolbar toolbar = (Toolbar) findViewById(R.id.yourToolbarId);
then
toolbar.setNavigationIcon(null);
Reference here: https://developer.android.com/reference/android/widget/Toolbar.html#setNavigationIcon(android.graphics.drawable.Drawable)
Parameters icon
Drawable to set, may be null to clear the icon
EDIT: if the title doesn't look aligned call:
toolbar.getMenu().clear();
final ActionBar ab = getSupportActionBar();
if (ab != null)
{
ab.setDisplayHomeAsUpEnabled(false);
}
To remove the totally unfashionable margin who have the toolbar in the left side for a posible navigation icon you should do:
toolbar.setContentInsetsAbsolute(0,0);