[英]Hide android status bar for my application on Android 4.0.4?
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?? 它的工作原理..有没有人知道如何在Android 4.0.4设备上隐藏状态栏?
Use the following in your Manifest 在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. 然而,这仅适用于手机,平板电脑不支持隐藏状态栏。
在onCreate
方法上尝试使用它。
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
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>
In your AndroidManifest just add it to android:theme
. 在AndroidManifest中,只需将其添加到
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. 您需要指定全屏,否则您的状态栏将被保留,只有您的标题栏会消失。
View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
doesn't hide the status bar. View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
不会隐藏状态栏。 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 在此处阅读更多内容: https : //developer.android.com/training/system-ui/status.html
This Solution worked with me : 此解决方案与我合作:
1- Root your device. 1-根设备。 use the tool in this site >> www.unlockroot.com
使用本网站的工具>> www.unlockroot.com
2- call this function at application start up >> https://stackoverflow.com/a/14940667/1995361 2-在应用程序启动时调用此函数>> https://stackoverflow.com/a/14940667/1995361
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.