2

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
  • 101
  • 2
  • 4
  • 12

6 Answers6

7

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.

Royston Pinto
  • 6,681
  • 2
  • 28
  • 46
  • Okay.. ('m using Android Network Media Player 4.0 device) .. But i downloaded a GMD HideBar 1.1.3.apk file from [Link](http://forum.xda-developers.com/showthread.php?t=1769761) and installed, it works.. Actually it hides status bar but problem is sometimes device will be restarted and sometimes it won't hide bar. – Arjun Kanti Dec 10 '12 at 12:00
  • 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. – SingleWave Games Dec 10 '12 at 12:07
2

Try with this on your onCreate method.

getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
Srinivas
  • 1,780
  • 1
  • 14
  • 27
Danimate
  • 69
  • 1
  • 3
  • This method worked for me. Its worth noting that I do have my current app restricted to landscape orientation though. – PsychoMantis Mar 23 '13 at 13:45
2
  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>
Deyu瑜
  • 484
  • 4
  • 14
0

In your AndroidManifest just add it to android:theme. Either of the following lines should work for you:

android:theme="@android:style/Theme.NoTitleBar.Fullscreen"

android:theme="@android:style/Theme.Black.NoTitleBar.Fullscreen"

You need to specify Fullscreen otherwise your status bar will be kept and only your Title bar will disappear.

whitfin
  • 4,539
  • 6
  • 39
  • 67
0

View.SYSTEM_UI_FLAG_HIDE_NAVIGATION doesn't hide the status bar. It hides the navigation bar. If you want to hide the status bar you should use:

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

or

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

Read more here: https://developer.android.com/training/system-ui/status.html

Saeed
  • 83
  • 1
  • 9
-1

This Solution worked with me :

1- Root your device. use the tool in this site >> www.unlockroot.com

2- call this function at application start up >> https://stackoverflow.com/a/14940667/1995361

Community
  • 1
  • 1
M.A
  • 57
  • 7