Toolbar overlapping below status bar

Use android:fitsSystemWindows="true" in the root view of your layout (LinearLayout in your case).
And android:fitsSystemWindows is an

internal attribute to adjust view layout based on system windows such
as the status bar. If true, adjusts the padding of this view to leave
space for the system windows. Will only take effect if this view is in
a non-embedded activity.

Must be a boolean value, either “true” or “false”.

This may also be a reference to a resource (in the form
“@[package:]type:name”) or theme attribute (in the form
“?[package:][type:]name”) containing a value of this type.

This corresponds to the global attribute resource symbol
fitsSystemWindows.

Leave a Comment