How can I prevent the navigation drawer toggle from sliding to the left / right when opening / closing the navigation drawer?
-> Like Material
mDrawerToggle = new ActionBarDrawerToggle(this, mDrawerLayout,
R.drawable.ic_drawer_indicator_new, //nav menu toggle icon
R.string.app_name, // nav drawer open - description for accessibility
R.string.app_name // nav drawer close - description for accessibility
Related
How to disable rotation animation on clicking 'navigation drawer indicator'
( hamburger icon) ?
I'm using a Htc model on geny motion emulator(1 GB ram). On clicking Navigation drawer icon, there is a slight lag on nav panel sliding (opening and closing).
So,I think, disabling animation would make sliding smoother.
(I'm using navigation drawer default template)
You can use the setDrawerSlideAnimationEnabled(boolean) to enable or disable the drawer arrow animation when the drawer position changes. An example of this would be:
// Installs drawer toggle
drawerToggle = new ActionBarDrawerToggle(this, drawerLayout,
R.string.drawer_open, R.string.drawer_close);
// Disables animation
drawerToggle.setDrawerSlideAnimationEnabled(false);
How can I change the colour of Hamburger​ button of a navigation drawble of inbulid Android studio navigation activity.?
You can set a custom icon:
mDrawerToggle = new ActionBarDrawerToggle(this, mDrawerLayout,
yourCustomIcon, R.string.drawer_open, R.string.drawer_close)
I changed all my previous tabs-activities app for a sliding_menu-fragments. The code to implement the sliding menu is using ActionBarDrawer (v4 which is deprecated now)
mDrawerToggle = new ActionBarDrawerToggle(this, mDrawerLayout,
R.drawable.ic_drawer, //nav menu toggle icon
R.string.app_name, // nav drawer open - description for accessibility
R.string.app_name // nav drawer close - description for accessibility
)
The sliding menu is working fine. And the ic_drawer icon which is called the hamburguer (3 bars), appear well in my phone (One Plus One). Besides it, the app icon, appears also without problem.
But running the same app on a Samsung phone the app icon disappear. Just the hamburguer is showed.
Please if somebody was having a similar issue and have something to say I'll really appreciates any advice.
In my Android app, I show the actionbar and normally in the far left is my app's logo and to the left of the logo is the icon that lets you display the navigation drawer. This icon is typically 3 horizontally bars above each other.
After modifying my app, this menu icon is no longer visible. Instead, an arrow for "back" is now displayed.
I even have:
setDisplayHomeAsUpEnabled(false);
This gets rid of the arrow for navigating Up (or back) but the 3 bar menu item never shows. I still can press on my app's logo to the right and it will bring up the navigation drawer.
What is preventing the menu icon from showing?
I already have this problem and it was when I used a Fragment instead of an Activity. When you use an activity, you got the three lines to open the menu (if of course you enabled it), if you have a fragment, then you have an arrow.
I personnally use this :
ActionBarDrawerToggle mDrawerToggle = new ActionBarDrawerToggle(this, mDrawerLayout,
R.drawable.ic_drawer, //nav menu toggle icon
R.string.app_name, // nav drawer open - description for accessibility
R.string.app_name // nav drawer close - description for accessibility
)
Where the ic_drawer is the 3 bars icons. I use this tutorial to create my app Drawer.
Hopefully this can help you anyhow =)
I am still struggling with finding a way to add padding/margin space between the navigation drawer icon in the action bar and the screen (top left of screen). Thanks in advance and I am trying to find any solution so either java or xml is perfect.
Regards,
Ryan
There is a tweak,
What you can do is that you can put the Navigation drawer icon to transparent and instead of application icon set the drawer icon.In that way the drawer icon will be moved away from left side of your screen.
ActionBar bar;
bar = getActionBar();
bar.setIcon(getResources().getDrawable(R.drawable.ic_drawer));//where R.drawable.ic_drawer is your drawer icon
ActionBarDrawerToggle mDrawerToggle;
mDrawerToggle = new ActionBarDrawerToggle(this, mDrawerLayout,
R.drawable.ic_drawer_transparent, //nav menu toggle icon
R.string.app_name, // nav drawer open - description for accessibility
R.string.app_name // nav drawer close - description for accessibility
)
I hope this helps you in some way.
For padding, you can use:
ImageView view = (ImageView)findViewById(android.R.id.home);
view.setPadding(left, top, right, bottom);