2

I am building an app that needs to hide/show status bar. It works well for phones without notches, but I can't find a way to hide/show the status bar in phones with notches. Is there a way to handle different notches for the status bar?

1 Answers1

0

I think you can use activity flag to show and hide status bar. You can use following code in manifest for hide status bar for specific activity.

android:theme="@android:style/Theme.NoTitleBar.Fullscreen"

You can also change flag at run time.

// Hide status bar
getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
// Show status bar
getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);

You can also check here whether device has notch display or not and according to this you can manage that flag to show and hide status bar.

Prayag Gediya
  • 1,078
  • 2
  • 11
  • 20