Hide android status bar for my application on Android 4.0.4?

15,351

Solution 1

Use the following in your Manifest

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

This however will only work on phones, Tablets do not support hiding of status bar.

Solution 2

Try with this on your onCreate method.

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

Solution 3

  1. add a style and extend Theme.AppCompat.NoActionBar , and add two item.

like this

 <style name="AppTheme" parent="Theme.AppCompat.NoActionBar">
        <!-- Customize your theme here. -->
        <item name="colorPrimary">@color/colorPrimary</item>
        <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
        <item name="colorAccent">@color/colorAccent</item>
        <item name="android:windowFullscreen">true</item>
        <item name="android:windowContentOverlay">@null</item>
    </style
  1. setup your application with this theme.

like this

<application
    ...
    android:theme="@style/AppTheme"
    ...>
</application>
Share:
15,351
Arjun Kanti
Author by

Arjun Kanti

Updated on June 14, 2022

Comments

  • Arjun Kanti
    Arjun Kanti almost 2 years

    I tried with the following code to hide status bar but it doesn't work..

    getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_HIDE_NAVIGATION);
    

    and to dim the bar i used

     getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LOW_PROFILE);
    

    and it works.. Does any one know how to hide status bar on Android 4.0.4 device??

  • Arjun Kanti
    Arjun Kanti over 11 years
    Okay.. ('m using Android Network Media Player 4.0 device) .. But i downloaded a GMD HideBar 1.1.3.apk file from Link and installed, it works.. Actually it hides status bar but problem is sometimes device will be restarted and sometimes it won't hide bar.
  • Raj
    Raj over 11 years
    THe above code should work correctly, you do however need to keep in mind you need to add the above code to each activity you have.
  • PsychoMantis
    PsychoMantis about 11 years
    This method worked for me. Its worth noting that I do have my current app restricted to landscape orientation though.