View
 

Hiding the status bar at the top in Android

Page history last edited by Paul Higgins 7 months, 1 week ago Saved with comment

There are two ways to achive this effect:

  • by editing DroidGap.java file
  • by editing Your Activity java file

 

First method - DroidGap.java

 

In Eclipse open DroidGap.java. Find the function public void onCreate(Bundle savedInstanceState). Find the lines that look like this:

 

getWindow().setFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN,
                WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN);


And change them to this:

 

getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, 
               WindowManager.LayoutParams.FLAG_FULLSCREEN);

 

Second Method - Your Activity java file

 

Add the following line in onCreate of Your Activity (main class inherited from DroidGap class):

 

getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, 
                    WindowManager.LayoutParams.FLAG_FULLSCREEN | 
                    WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN);

This will clear WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN flag and set WindowManager.LayoutParams.FLAG_FULLSCREEN flag for main window.

 

You will also need to add the following line to the imports:

 

import android.view.WindowManager;