File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -281,6 +281,18 @@ Make sure to set `android:fitsSystemWindows="true"` on your `AppBarLayout` (or
281281` MaterialToolbar ` if not using ` AppBarLayout ` ), so that an extra inset is added
282282to avoid overlap with the status bar.
283283
284+ If your ` AppBarLayout ` scrolls and content is visible under the status bar, you
285+ can set the ` AppBarLayout ` 's ` statusBarForeground ` to a ` MaterialShapeDrawable `
286+ to let ` AppBarLayout ` automatically match the status bar color to its own
287+ background.
288+
289+ In code:
290+
291+ ```
292+ appBarLayout.setStatusBarForeground(
293+ MaterialShapeDrawable.createWithElevationOverlay(getContext()));
294+ ```
295+
284296### Center aligned top app bar example
285297
286298All of the same guidance and code from the sections above is relevant for Center
You can’t perform that action at this time.
0 commit comments