vivek tiwari
vivek tiwari

Reputation: 645

Hide/ Show notification bar in android

I am able to hide notification bar using this code

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

But I want the user to have an option to show and hide notification bar. Currently my Activity permanently hides the notification bar.

How cam I do it?

Upvotes: 0

Views: 2420

Answers (1)

iTech
iTech

Reputation: 18460

You can exit full screen mode (i.e. show status bar) by using:

getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
getWindow().addFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN);                 

Upvotes: 1

Related Questions