Android Dev
Android Dev

Reputation: 535

How to get Scaffold to Appear Over Top Notification Bar in Jetpack Compose?

I want my scaffold to appear over the top of the notification bar, is this possible?

This is what I have (can't show much due to company policy):

enter image description here

I want the scaffold to go over the time and battery symbol.

This is what I want:

enter image description here

The above image is from Google Developers documentation site: https://developer.android.com/jetpack/compose/layouts/material#modal-drawers

My code:

Scaffold(
 scaffoldState = scaffoldState,
 topBar = {
  TopBarComposable() // Where you see the Edit button is bottom right
 },
 drawerContent = {
  DrawerContentComposable()
 },
 content = {
  ContentComposable() // The main screen thats under the Top Bar Composable
 },
 bottomBar = { BottomBarComposable() },
 drawerShape = RectangleShape
)

Any help would be greatly appreciated!

Upvotes: 1

Views: 1439

Answers (1)

Abhimanyu
Abhimanyu

Reputation: 14787

Use WindowCompat.setDecorFitsSystemWindows

// Turn off the decor fitting system windows, which allows us to handle insets, including IME animations
WindowCompat.setDecorFitsSystemWindows(window, false)

Source: Now In Android

Refer here for more details.

Note, you also have to handle padding manually.

Upvotes: 2

Related Questions