android - Toggle Fullscreen mode -


i need toggling fullscreen mode. have setting in preference screen go fullscreen. in main activity's onresume have:

if(mfullscreen == true) {                 getwindow().addflags(windowmanager.layoutparams.flag_fullscreen);                 getwindow().clearflags(windowmanager.layoutparams.flag_force_not_fullscreen);              } else             {                 getwindow().addflags(windowmanager.layoutparams.flag_force_not_fullscreen);                 getwindow().clearflags(windowmanager.layoutparams.flag_fullscreen);              } 

but doesn't seem work because needs called before setcontentview right?

... also, have requestwindowfeature(window.feature_no_title); before setcontentview , takes away title , status bar... can offer help?

---edit--- ok, had bug causing not work. does. now, need know how toggle title bar.

private void setfullscreen(boolean fullscreen) {     windowmanager.layoutparams attrs = getwindow().getattributes();     if (fullscreen)     {         attrs.flags |= windowmanager.layoutparams.flag_fullscreen;     }     else     {         attrs.flags &= ~windowmanager.layoutparams.flag_fullscreen;     }     getwindow().setattributes(attrs); } 

Comments

Popular posts from this blog

objective c - Change font of selected text in UITextView -

php - Accessing POST data in Facebook cavas app -

c# - Getting control value when switching a view as part of a multiview -