I use SlidingMenu to implement my slide-in menus.
The code is
private void initSlidingMenu() { // configure the SlidingMenu menu = new SlidingMenu(this); menu.setMode(SlidingMenu.LEFT); menu.setTouchModeAbove(SlidingMenu.TOUCHMODE_FULLSCREEN); menu.setShadowWidthRes(R.dimen.shadow_width); // menu.setShadowDrawable(R.drawable.shadoew); menu.setBehindOffsetRes(R.dimen.slidingmenu_offset); // menu.setFadeDegree(0.35f); menu.attachToActivity(this, SlidingMenu.SLIDING_WINDOW); menu.setMenu(R.layout.menu_main_sliding); }
Then I got a problem is my layout behind of navigation bar.
And i change the SlidingMenu.SLIDING_WINDOW to SlidingMenu.SLIDING_CONTENT. It's works,but the actionbar always on the top.
Look at the source code of SlidingMenu,i find this code to add slidingmenu.
switch (slideStyle) {
case SLIDING_WINDOW:
mActionbarOverlay = false;
ViewGroup decor = (ViewGroup) activity.getWindow().getDecorView();
ViewGroup decorChild = (ViewGroup) decor.getChildAt(0);
// save ActionBar themes that have transparent assets
decorChild.setBackgroundResource(background);
decor.removeView(decorChild);
decor.addView(this);
setContent(decorChild);
break;
case SLIDING_CONTENT:
mActionbarOverlay = actionbarOverlay;
// take the above view out of
ViewGroup contentParent = (ViewGroup)activity.findViewById(android.R.id.content);
View content = contentParent.getChildAt(0);
contentParent.removeView(content);
contentParent.addView(this);
setContent(content);
// save people from having transparent backgrounds
if (content.getBackground() == null)
content.setBackgroundResource(background);
break;
}
How can i fix it? This bug only found in Android 5.0 lollipop.
SlidingMenu on GitHub has opened same issue.