EdgeToEdge

Added in 1.8.0

public final class EdgeToEdge


Summary

Public methods

static final void
enable(
    @NonNull ComponentActivity receiver,
    @NonNull SystemBarStyle statusBarStyle,
    @NonNull SystemBarStyle navigationBarStyle
)

Enables the edge-to-edge display for this ComponentActivity.

Public methods

enable

public static final void enable(
    @NonNull ComponentActivity receiver,
    @NonNull SystemBarStyle statusBarStyle,
    @NonNull SystemBarStyle navigationBarStyle
)

Enables the edge-to-edge display for this ComponentActivity.

To set it up with the default style, call this method in your Activity's onCreate method:

    override fun onCreate(savedInstanceState: Bundle?) {
enableEdgeToEdge()
super.onCreate(savedInstanceState)
...
}

The default style configures the system bars with a transparent background when contrast can be enforced by the system (API 29 or above). On older platforms (which only have 3-button/2-button navigation modes), an equivalent scrim is applied to ensure contrast with the system bars.

See SystemBarStyle for more customization options.

Parameters
@NonNull SystemBarStyle statusBarStyle

The SystemBarStyle for the status bar.

@NonNull SystemBarStyle navigationBarStyle

The SystemBarStyle for the navigation bar.