I need some help toggling fullscreen mode. I have a setting in a preference screen to go fullscreen. In my main activity's onResume I 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 this doesn't seem to work because it needs to be called before setContentView
right?
... But Also, I have requestWindowFeature(Window.FEATURE_NO_TITLE);
before setContentView
and it takes away the title AND status bar... Can anybody offer some help?
---Edit--- Ok, I had a bug that was causing this to not work. So it actually does. Now, I just need to know how to toggle the title bar.
In a browser on a Windows computer, you can enter fullscreen mode by pressing the F11 key. The key or method for entering fullscreen mode may vary in other programs.
Hold down the Ctrl key (or the Command key on a Mac) and press the plus or minus keys on the keyboard to zoom in and out, respectively.
It can be any webpage you want. Press the F11 key. Now your browser is full screen. If you want to toggle the full-screen mode off, simply press F11 again.
To go full screen on Google Chrome, click the full screen mode icon in its hamburger menu. You can also enter full screen by pressing "F11" on PC or "Control + Command + F" on Mac. Mac users can also press the "expand window" button to enter or exit full screen in Chrome.
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); }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With