如何在android中禁用状态栏或通知栏,但不禁用标题栏?
我想禁用android中的状态栏或通知栏。我使用如何在android中禁用状态栏或通知栏,但不禁用标题栏?,android,notifications,statusbar,titlebar,Android,Notifications,Statusbar,Titlebar,我想禁用android中的状态栏或通知栏。我使用android:theme=“@android:style/theme.NoTitleBar.Fullscreen”禁用它,但它也会使我的标题栏禁用。如何仅禁用状态栏?在清单文件中尝试此选项: android:theme="@android:style/Theme.Black.NoTitleBar" 这是一个很好的教程,让你的工作完成 或者看看这个 如果希望隐藏它们,可以通过代码或“AndroidManifest.xml”中的主题设置
android:theme=“@android:style/theme.NoTitleBar.Fullscreen”
禁用它,但它也会使我的标题栏禁用。如何仅禁用状态栏?在清单文件中尝试此选项:
android:theme="@android:style/Theme.Black.NoTitleBar"
这是一个很好的教程,让你的工作完成 或者看看这个 如果希望隐藏它们,可以通过代码或“AndroidManifest.xml”中的主题设置来实现 要隐藏应用程序的标题栏,可以使用预定义的样式android:theme=“@android:style/theme.NoTitleBar”。如果您还想隐藏应用程序的状态栏,请使用android:theme=“@android:style/theme.NoTitleBar.Fullscreen”。例如,在我的Android开发教程中:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="de.vogella.android.temperature"
android:versionCode="1"
android:versionName="1.0">
<application android:icon="@drawable/icon" android:label="@string/app_name">
<activity android:name=".Convert"
android:label="@string/app_name"
android:theme="@android:style/Theme.NoTitleBar.Fullscreen" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
<uses-sdk android:minSdkVersion="9" />
</manifest>
这肯定会对你有所帮助
谢谢:)在onCreate函数中使用以下代码创建一个基本活动,并每次扩展该活动
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN);
或
您可以在每个活动中使用上述代码,使标题栏可见,但状态栏不可见
编辑:只需确保在Android清单中没有定义任何主题。在清单中使用全屏主题,然后 您可以定义一个包含标题的单独版面,然后在应用程序中的每个版面上使用include标记
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="AppBaseTheme" parent="android:Theme.NoTitleBar.Fullscreen">
<!-- API 11 theme customizations can go here. -->
</style>
</resources>
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="AppBaseTheme" parent="android:Theme.NoTitleBar">
<!-- API 11 theme customizations can go here. -->
</style>
</resources>
<style name="AppBaseTheme">
应用程序清单.xml:
:
:
<application android:label="@string/app_name"
android:icon="@drawable/ic_launcher"
android:theme="@style/AppBaseTheme"
>
:
:
:
:
:
:
结果:全屏无标题栏和状态栏
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="AppBaseTheme" parent="android:Theme.NoTitleBar.Fullscreen">
<!-- API 11 theme customizations can go here. -->
</style>
</resources>
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="AppBaseTheme" parent="android:Theme.NoTitleBar">
<!-- API 11 theme customizations can go here. -->
</style>
</resources>
<style name="AppBaseTheme">
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="AppBaseTheme" parent="android:Theme.NoTitleBar.Fullscreen">
<!-- API 11 theme customizations can go here. -->
</style>
</resources>
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="AppBaseTheme" parent="android:Theme.NoTitleBar">
<!-- API 11 theme customizations can go here. -->
</style>
</resources>
<style name="AppBaseTheme">
结果:
他想保持沉默titlebar@Nunu那么,android mobile中的状态栏是什么?@SpK状态栏意味着顶部栏包含通知图标、网络信号图标等。我认为如果标题栏必须可见,那么状态栏将自动可见。@AndroidCoader我知道。User@Nunu告诉用户“他想保留标题栏”,所以用户应该使用
android:theme=“@android:style/Theme.NoTitleBar
获取他所需的风格。如果我的答案对您有所帮助,请不要忘记接受我的答案,我们将不胜感激。谢谢:)不行,兄弟。它的作用与全屏属性相同。它隐藏了一切。但标题栏和状态栏仍然存在。goneWell,我尝试了你的解决方案,但它没有显示任何内容。其他人可以提供任何反馈吗?@Yogessomani查看屏幕截图,请检查您的menifest是否提供了任何类型的主题是的,我已经在我的清单中定义了android:theme=“@android:style/theme.Black.NoTitleBar”。我也试过全屏。没有一个奏效。