Compose Modifier

windowInsetsBottomHeight

Sets the height to that of insets at the bottom of the screen.

insetsBottomHeightSample

@Sampled
fun insetsBottomHeightSample() {
    class SampleActivity : ComponentActivity() {
        override fun onCreate(savedInstanceState: Bundle?) {
            WindowCompat.setDecorFitsSystemWindows(window, false)
            super.onCreate(savedInstanceState)
            setContent {
                Box(Modifier.fillMaxSize()) {
                    // Background for navigation bar at the bottom
                    Box(
                        Modifier.windowInsetsBottomHeight(WindowInsets.navigationBars)
                            .fillMaxWidth()
                            .align(Alignment.BottomCenter)
                            .background(Color.Red)
                    )
                    // app content
                }
            }
        }
    }
}
Jetpack Compose beyond MaterialFree components, screens and templates for apps that don’t look like Google’s. Copy them into your app, or let your coding agent add them.Browse for free

Content updated: