How to save action / title bar but hide notification bar

How to save action bar / title but hide notification bar?

This question looks like it has already been answered, but most of the answers I found hide both the action bar and the notification bar. I want to be able to hold an action / title bar. The best I got is to hide both and use a linear layout to display a custom action / title bar, but I want the system to generate it. Also can only hide the action bar by showing the notification bar?

+4
source share
2 answers

To hide the notification panel, use the following code:

WindowManager.LayoutParams attrs = act.getWindow().getAttributes(); attrs.flags |= WindowManager.LayoutParams.FLAG_FULLSCREEN; act.getWindow().setAttributes(attrs); 

To display the notification panel, use the following code:

 WindowManager.LayoutParams attrs = act.getWindow().getAttributes(); attrs.flags &= ~WindowManager.LayoutParams.FLAG_FULLSCREEN; act.getWindow().setAttributes(attrs); 

You probably want to call the code in Activity.onCreate ().

+7
source
 <style name="MyCustom_Theme.FullScreen"> <item name="android:windowFullscreen">true</item> <item name="android:windowContentOverlay">@null</item> </style> 
+2
source

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


All Articles