Skip to content

Fix black bar on cutout side after device rotation#1938

Open
rybnikov wants to merge 1 commit intoDrKLO:masterfrom
rybnikov:fix/cutout-black-bar-on-rotation
Open

Fix black bar on cutout side after device rotation#1938
rybnikov wants to merge 1 commit intoDrKLO:masterfrom
rybnikov:fix/cutout-black-bar-on-rotation

Conversation

@rybnikov
Copy link

@rybnikov rybnikov commented Feb 27, 2026

Problem

On devices with a display cutout (notch/punch-hole camera), a black bar appears on the cutout side in landscape orientation. The app interface doesn't extend to the full screen area — the cutout region stays black.

Root cause

Two issues combine to create the black bar:

  1. windowLayoutInDisplayCutoutMode is set to shortEdges — this only allows the window to extend into the cutout area on short edges of the screen. In landscape, the cutout is on a long edge, so the system prevents the window from rendering there.

  2. DrawerLayoutContainer voluntarily avoids the cutout — it includes WindowInsetsCompat.Type.displayCutout() when calculating child view margins and draws black rectangles over the cutout areas in onDraw(). Even if the window mode allowed rendering there, the container would still push content away and fill the gap with black.

Fix

  1. Change windowLayoutInDisplayCutoutMode from shortEdges to always in v31 styles, so the window extends into the cutout area on all edges (API 30+).

  2. Remove displayCutout() from the inset types used in DrawerLayoutContainer for child margin calculation and background drawing. Content now fills the full screen including behind the cutout.

In landscape orientation, the display cutout moves to a long edge of
the screen. With windowLayoutInDisplayCutoutMode set to shortEdges,
the system prevents the window from extending into the cutout area on
long edges, leaving a black bar.

Two changes fix this:

1. Set windowLayoutInDisplayCutoutMode to "always" (API 30+) so the
   window extends into the cutout area on all edges, not just short
   ones.

2. Stop DrawerLayoutContainer from voluntarily avoiding the cutout:
   remove displayCutout() from the inset types used to calculate
   child margins and to draw black background rects. The content now
   fills the full screen area including behind the cutout.
@rybnikov rybnikov force-pushed the fix/cutout-black-bar-on-rotation branch from 06c48cd to 628dd8b Compare February 27, 2026 20:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant