Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

I want to disable status bar or notification bar in android. I use android:theme="@android:style/Theme.NoTitleBar.Fullscreen" for disable it but it makes my title bar disable too. how can I only disable status bar?

like image 548
kongkea Avatar asked Jul 23 '12 10:07

kongkea


People also ask

How do I disable the notification bar?

Head onto Android Settings -> Advanced Restrictions -> Display Settings -> Enable Modify System Bars -> Enable Hide Status Bar. If the devices are in Kiosk mode, you could disable the status bar from Kiosk Settings -> Peripheral Settings -> Enable status bar under Display settings.


2 Answers

Make a base activity with below code in onCreate function and extend that activity every time

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

Or

you can have above code in every activity for having Title bar visible but status bar invisible.

EDIT: Just make sure you don't define any theme in your Android Manifest.

like image 142
rajpara Avatar answered Sep 21 '22 22:09

rajpara


Use the full screen theme in your manifest and then You can defined a separate layout with your title in it then use the include tag on every layout in your app.

like image 39
iamkristher Avatar answered Sep 22 '22 22:09

iamkristher