Home > Net >  Hide System bars and go full screen in fragment
Hide System bars and go full screen in fragment

Time:10-21

I have been trying to make a fragment fullscreen, but almost every answer on the web has deprecated methods. Even the android official site has a deprecated method enter image description here

You can clearly see navigation and status bars are still there.

Can you share the proper and latest way to get fullscreen in fragment?

CodePudding user response:

If you read the docs for ViewCompat.getWindowInsetsController(), you'll see that it's only deprecated because they want you to use getInsetsController() instead. Otherwise, the sample code works just fine.

CodePudding user response:

Can you use the theme as follows

    <style name="AppTheme"parent="Theme.MaterialComponents.DayNight.NoActionBar">
    <item name="android:windowNoTitle">true</item>
    <item name="android:windowActionBar">false</item>
    <item name="android:windowFullscreen">true</item>
    <item name="android:windowContentOverlay">@null</item>
    </style>
  • Related