How to handle cutout area by compose?

1.1k Views Asked by At

I'm a Android development beginner . How to handle cutout area by compose? As far as I know... WindowManager doesn't provide information about cutout area. and LayoutInDisplayCutoutMode can be set in xml file. I ask for your advice, please.

1

There are 1 best solutions below

0
On BEST ANSWER

In Compose 1.2.* you can get it like this:

// get value:
WindowInsets.displayCutout

// apply padding modifier:
Modifier.displayCutoutPadding() 

In earlier versions you can use Accompanist Insets library:

// get value:
LocalWindowInsets.current.displayCutout

// apply padding modifier:
Modifier.cutoutPadding()