I have refined the Navigation Drawer Activity project template of Android Studio, which uses Toolbar, v7.app.ActionBarDrawerToggle and
For those with the same issue as above, but want to keep the system status bar always showing (thus not using WindowManager.LayoutParams.FLAG_FULLSCREEN
), there is some additional work you have to do to prevent a weird content creep underneath the status bar on lollipop. I didn't notice the issue on kitkat when I tested it.
I was using two navigation drawers (left and right) and weirdly had only the LEFT one casting the shadow on the bottom. Once applying WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS
as shown in the accepted answer, the shadow went away but then had the content creep under the status bar as well as the navigation drawer drawing on top of the status bar; all the way to the device bezel.
To fix that you must overwrite your theme in v21 styles.xml to include:
- false
- @color/colorPrimaryDark
This will move the content back below the status bar and also prevent the navigation drawer from drawing on top of the status bar.
In addition to the above entries in my v21 styles, my activity code looked like this:
// Fixes bottom navbar shadows from appearing on side navigation drawers
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
WindowManager.LayoutParams attributes = getWindow().getAttributes();
attributes.flags |= WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS;
getWindow().setAttributes(attributes);
}