Android statusbar overlay with ActionBar-ThrowExceptions

Exception or error:

I know that I can make the ActionBar overlay using requestFeature(Window.FEATURE_ACTION_BAR_OVERLAY)
and can toggle/show the status bar in my screen (by switching between FLAG_FULLSCREEN and FLAG_FORCE_NOT_FULLSCREEN).
This works great. However, I don’t want my layout moving when I toggle the status bar.

I know that I can make the status bar “overlay” (albeit not transparently) the content using:


This works also great, except for the (expected) consequence that, when using an ActionBar, the ActionBar gets half cut off – half of it is under the status bar basically.

So I am wondering, is there a way to “move the ActionBar down” by the status bar’s height in this case?
I know that in worse case, I can do this with a custom view that lives within the layout, but I rather not do this (want to benefit from the ActionBar).


How to solve:

so apparently, you can do this in Jellybean. google includes two examples in the api docs. here is a link:

use setSystemUiVisibility on a view to toggle visibility (on jellybean+).


It’s not perfect, but this is how I have achieved what you want:

In onCreate:



private void hideStatusBar() {


private void showStatusBar() {


I also have a style on the activity with the following:

 <style name="readingStyle" parent="@style/Theme.Sherlock">
     <item name="android:windowActionBarOverlay">true</item>  
     <item name="windowActionBarOverlay">true</item>       

Your activity will shift down when the status bar shows, but I don’t think it’s too noticeable.


Why you dont make it in the Manifest


than you have no statusbar and more space for the Actionbar??


Put this method in onCreate() method activity:


refer: link

Leave a Reply

Your email address will not be published. Required fields are marked *