How do I make an activity full screen? I mean without the notification bar. Any ideas?
TIP: Using getWindow().setLayout() can screw up your full screen display! Note the documentation for this method says:
Set the width and height layout parameters of the window... you can change them to ... an absolute value to make a window that is not full-screen.
http://developer.android.com/reference/android/view/Window.html#setLayout%28int,%20int%29
For my purposes, I found that I had to use setLayout with absolute parameters to resize my full screen window correctly. Most of the time, this worked fine. It was called by an onConfigurationChanged() event. There was a hiccup, however. If the user exited the app, changed the orientation, and reentered, it would lead to firing off my code which included setLayout(). During this re-entry time window, my status bar (which was hidden by the manifest) would be made to re-appear, but at any other time setLayout() would not cause this! The solution was to add an additional setLayout() call after the one with the hard values like so:
public static void setSize( final int width, final int height ){
//DO SOME OTHER STUFF...
instance_.getWindow().setLayout( width, height );
// Prevent status bar re-appearance
Handler delay = new Handler();
delay.postDelayed( new Runnable(){ public void run() {
instance_.getWindow().setLayout(
WindowManager.LayoutParams.FILL_PARENT,
WindowManager.LayoutParams.FILL_PARENT );
}}, FILL_PARENT_ON_RESIZE_DELAY_MILLIS );
}
The window then correctly re-sized, and the status bar did not re-appear regardless of the event which triggered this.