Reputation: 131
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??
Upvotes: 2
Views: 15383
Reputation: 544
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
like this
<application
...
android:theme="@style/AppTheme"
...>
</application>
Upvotes: 2
Reputation: 83
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
Upvotes: 0
Reputation: 57
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
Upvotes: -1
Reputation: 69
Try with this on your onCreate
method.
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
Upvotes: 2
Reputation: 4629
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.
Upvotes: 0
Reputation: 6721
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.
Upvotes: 7