Compose Modifier

mandatorySystemGesturesPadding

Adds padding to accommodate the mandatory system gestures insets.

mandatorySystemGesturesPaddingSample

@Sampled
fun mandatorySystemGesturesPaddingSample() {
    class SampleActivity : ComponentActivity() {
        override fun onCreate(savedInstanceState: Bundle?) {
            WindowCompat.setDecorFitsSystemWindows(window, false)
            super.onCreate(savedInstanceState)
            setContent {
                Box(Modifier.background(Color.Blue).systemBarsPadding()) {
                    // The app content won't interfere with the mandatory system gestures area.
                    // It will just be white.
                    Box(Modifier.background(Color.White).mandatorySystemGesturesPadding()) {
                        // 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: