Skip to content Skip to sidebar Skip to footer

How Can I Keep The Action/title Bar But Hide The Notification Bar

How can I keep the action/title bar but hide the notification bar? This question looks like it has already been answered but most of the answers I found hide both the action bar an

Solution 1:

To hide the notification bar use the follow code:

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

To show the notification bar use the follow code:

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

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

Solution 2:

<stylename="MyCustom_Theme.FullScreen"><itemname="android:windowFullscreen">true</item><itemname="android:windowContentOverlay">@null</item></style>

Post a Comment for "How Can I Keep The Action/title Bar But Hide The Notification Bar"