Fullscreen in WindowManager

This code from "Android Application 4 Development". you have to handle different android versions

 // Hiding the Action Bar for different android versions 
    if (Build.VERSION.SDK_INT < 16) {
        // Hide the Action Bar on Android 4.0 and Lower
         getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
     }else {
        // Hide the Action Bar on Android 4.1 and Higher
        View decorView = getWindow().getDecorView();
        int uiOptions = View.SYSTEM_UI_FLAG_FULLSCREEN;
        decorView.setSystemUiVisibility(uiOptions);
        android.app.ActionBar actionBar = getActionBar();
        actionBar.hide();
     }

All I had to do was this

params.flags=WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN| and the rest

This extends the overlay view over the status bar.


You can hide the status bar using two ways :

1) Define below line in your activity onCreate() method.

  requestWindowFeature(Window.FEATURE_NO_TITLE);

2)Define the theme at the application level not to show the status bar through out application as below:

<application android:label="@string/app_name"
  android:theme="@android:style/Theme.NoTitleBar.Fullscreen">