android - Show navigation drawer in large and remove in xlarge -


i developing android app tablet in got scenario, have display menu using navigation drawer in large device , in x-large device display menu layout , no navigation drawer there. can suggest idea how this?

use different layout files large (contains nav drawer xml code) , x-large (does not contain nav drawer xml code) device.

in java code,

drawerlayout mdrawerlayout = (drawerlayout)findviewbyid(r.id.drawer_layout);  if (mdrawerlayout != null) {       //checking null make sure there no null pointer exception in x-large screens there no nav drawer layout.      //add similar null check mdrawerlayout wherever using mdrawerlayout variable.       // setup actionbar icon.      getsupportactionbar().sethomebuttonenabled(true);     getsupportactionbar().setdisplayhomeasupenabled(true);      // actionbardrawertoggle ties proper interactions     // between sliding drawer , action bar app icon     mdrawertoggle = new actionbardrawertoggle(             this,             mdrawerlayout,             r.drawable.ic_drawer,             r.string.drawer_open,             r.string.drawer_close) {          public void ondrawerclosed(view view) {             super.ondrawerclosed(view);         }          public void ondraweropened(view drawerview) {             // set title on action when drawer open             getsupportactionbar().settitle(mdrawertitle);             super.ondraweropened(drawerview);         }     };      mdrawerlayout.setdrawerlistener(mdrawertoggle); } 

Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

ios - Change Storyboard View using Seague -