android - Cannot open navigationbar -
i click floatingactionbutton open navigation menu, not working
drawerlayout drawer = (drawerlayout) findviewbyid(r.id.drawer_layout); floatingactionbutton fab = (floatingactionbutton) findviewbyid(r.id.fab); fab.setonclicklistener(new view.onclicklistener() { @override public void onclick(view view) { drawer.isdraweropen(gravitycompat.start); } });
no errors in logcat.
1 help.
your isdraweropen
method checks if drawer open or not , not doing checks. can use in onclick
method:
if(drawer.isdraweropen(gravitycompat.start)) { closenavdrawer(); }else { drawer.opendrawer(gravitycompat.start); }
closenavdrawer
method:
protected void closenavdrawer() { if (drawer != null) { drawer.closedrawer(gravitycompat.start); } }
Comments
Post a Comment