You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ViewCompat.setOnApplyWindowInsetsListener(toolBar) { v: View, insets: WindowInsetsCompat ->
val barInset = insets.getInsets(WindowInsetsCompat.Type.systemBars())
// Add padding to this view based on status bar inset
v.updatePadding(top = barInset.top)
WindowInsetsCompat.CONSUMED
}
XML (style)
<!-- Toolbar style on both light and night mode -->
<style name="MDCToolbar" parent="Widget.Material3.Toolbar.Surface" tools:keep="@style/MDCToolbar">
<item name="contentInsetStart">0dp</item>
<item name="contentInsetEnd">0dp</item>
<item name="contentInsetStartWithNavigation">0dp</item>
<item name="materialThemeOverlay">@style/ThemeOverlay.MDC.Toolbar</item>
</style>
<style name="ThemeOverlay.MDC.Toolbar" parent="" tools:keep="@style/ThemeOverlay_MDC_Toolbar">
<!-- Background color -->
<item name="colorSurface">@color/mdc_colorWhite_Primary</item>
<!-- Title and Navigation icon color -->
<item name="colorOnSurface">@color/mdc_colorPrimaryDark_White</item>
<!-- Subtitle and Action item color -->
<item name="colorOnSurfaceVariant">@color/mdc_colorPrimaryDark_White</item>
<!-- Action item and Overflow menu color when `colorOnSurfaceVariant` is not working -->
<!-- Drawer icon and Navigation icon also use this -->
<item name="colorControlNormal">@color/mdc_colorPrimaryDark_White</item>
</style>
Description:
MaterialToolbar height is incorrect for phone size devices after adapting to edge-to-edge enforcement for Android 15.
Phone (Portrait)
Phone (Landscape)
Expected behavior:
Correct MaterialToolbar height on both portrait and landscape orientation for phone size devices, tablet size devices are fine.
Tablet (Portrait)
Tablet (Landscape)
Source code:
XML layout (Phone portrait)
XML layout (Tablet portrait)
Activity with inset adjustment
XML (style)
Minimal sample app repro:
N/A
Android API version:
5.0 and above
Material Library version:
1.12.0
Device:
AVD/Emulators
The text was updated successfully, but these errors were encountered: