android activity - The getDecorView method return view include navigation bar view on lollipop? -


i use slidingmenu implement slide-in menus.

the code

private void initslidingmenu() {     // configure 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 got problem layout behind of navigation bar. my bottom view behind of navigation barmy bottom layout behind of navigation bar

and change slidingmenu.sliding_window slidingmenu.sliding_content. it's works,but actionbar on top.

look @ source code of slidingmenu,i find code add slidingmenu.

    switch (slidestyle) {     case sliding_window:         mactionbaroverlay = false;         viewgroup decor = (viewgroup) activity.getwindow().getdecorview();         viewgroup decorchild = (viewgroup) decor.getchildat(0);         // save actionbar themes have transparent assets         decorchild.setbackgroundresource(background);         decor.removeview(decorchild);         decor.addview(this);         setcontent(decorchild);         break;     case sliding_content:         mactionbaroverlay = actionbaroverlay;         // take 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 having transparent backgrounds         if (content.getbackground() == null)             content.setbackgroundresource(background);         break;     } 

how can fix it? bug found in android 5.0 lollipop.

slidingmenu on github has opened same issue.

private int getnavigationbarheight() {      resources resources = getresources();     int resourceid = resources.getidentifier("navigation_bar_height", "dimen", "android");     if (resourceid > 0) {         return resources.getdimensionpixelsize(resourceid);     }      return 0;  }   @override  public void oncreate(bundle savedinstancestate) {     if (build.version.sdk_int >= build.version_codes.lollipop) {         int navbarheight = getnavigationbarheight();         findviewbyid(r.id.base_frame).setpadding(0, 0, 0, navbarheight);         findviewbyid(r.id.menu_frame).setpadding(0, 0, 0, navbarheight);     }  }  

Comments

Popular posts from this blog

matlab - "Contour not rendered for non-finite ZData" -

delphi - Indy UDP Read Contents of Adata -

javascript - Any ideas when Firefox is likely to implement lengthAdjust and textLength? -