How to disable the status bar or notification bar but not disable the title bar in android?

I want to disable the status bar or notification bar in android. I use android:theme="@android:style/Theme.NoTitleBar.Fullscreen" to disable it, but it also disables my title. how can i just turn off the status bar?

+6
source share
5 answers

Make a basic activity using the code below in the onCreate function and renew this activity every time

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

Or

you may have the code above in every action, since the title bar is visible, but the status bar is invisible.

EDIT: just make sure you don't define any theme in your Android manifest.

+9
source

Use a full-screen theme in your manifest, and then you can define a separate layout with your title, and then use the include tag for each layout in your application.

+1
source

Here is a very good tutorial to do your job.

Android - delete status and application title bar

OR look at it

If you want to hide them, you can do this either using the code or by setting the theme in your AndroidManifest.xml.

To hide the title of your application, you can use the predefined style android: theme = "@android: style / Theme.NoTitleBar". If you also want to hide the status bar of your application, use Android: theme = "@android: style / Theme.NoTitleBar.Fullscreen". For example, in my Android development tutorial:

 <?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> 

This will help you.

Thanks:)

0
source
  • No title. No Status bar showing fullscreen Android (most commonly used in games)

res-> with value> styles.xml:

 <?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> 

Manifest.xml application:

 : : <application android:label="@string/app_name" android:icon="@drawable/ic_launcher" android:theme="@style/AppBaseTheme" > : : 

Result: full screen without title and status bar enter image description here

  1. There is no title bar displaying only the status bar of the phone. In the same file, just delete ".Fullscreen"

    res-> with value> styles.xml:

     <?xml version="1.0" encoding="utf-8"?> <resources> <style name="AppBaseTheme" parent="android:Theme.NoTitleBar"> <!-- API 11 theme customizations can go here. --> </style> </resources> 

Result: only the status bar is displayed without a full title bar enter image description here

  1. Display status bar and title bar

res-> with value> styles.xml:

  <style name="AppBaseTheme"> 

Result: enter image description here

0
source

Try this in the manifest file:

  android:theme="@android:style/Theme.Black.NoTitleBar" 
-1
source

Source: https://habr.com/ru/post/921119/


All Articles