Shreyash.K
Shreyash.K

Reputation: 1148

Scaffold with floating Topbar (Jetpack Compose)

I need a topbar in Scaffold composable which floats over the main content (body). Currently the Scaffold puts the topbar on the main content. This reduces the size of the main content which should fill the entire screen.

Jetpack compose Scaffold and Topbar: Current and expected behaviors

Upvotes: 0

Views: 1958

Answers (1)

S Haque
S Haque

Reputation: 7281

In that case you can add TopAppBar composable in your content section of Scaffold

Scaffold {
      Box {
           BodyContent()
           TopAppBar(modifier = Modifier.fillMaxWidth()) {
           }
      }
}

Upvotes: 1

Related Questions