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 !
Remove Android Toolbar Navigation Drawer option
Asked Answered
getSupportActionBar().setDisplayHomeAsUpEnabled(false)
This should remove the navigation drawer icon
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);
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();
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);
this unswer helps me when i am using fragment with AppBarLayout and Toolbar in it –
Flaxen
final ActionBar ab = getSupportActionBar();
if (ab != null)
{
ab.setDisplayHomeAsUpEnabled(false);
}
© 2022 - 2024 — McMap. All rights reserved.