material-components / material-components/material-components-android

MaterialToolbar bug in height after adaption on edge-to-edge enforcement of Android 15

Open
#4,464 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug Widget: TopAppBar
Dominant language
Java
Stars
17.4k
Forks
3.2k
PR merge metrics
No merged PRs in 30d

Description

**Description:**
**MaterialToolbar** height is incorrect for **phone size devices** after adapting to edge-to-edge enforcement for Android 15.

Phone (Portrait)
image

Phone (Landscape)
image

Layout bounds
image

**Expected behavior:**
Correct **MaterialToolbar** height on both portrait and landscape orientation for phone size devices.

Tablet (Portrait)
image

Tablet (Landscape)
image

**Source code:**

XML layout (Phone portrait)
```

```

XML layout (Tablet portrait)
```

```

Activity with inset adjustment
```
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)
```


<item name="contentInsetStart">0dp</item>
<item name="contentInsetEnd">0dp</item>
<item name="contentInsetStartWithNavigation">0dp</item>
<item name="materialThemeOverlay">@style/ThemeOverlay.MDC.Toolbar</item>


<!-- 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>

```

```

<item name="toolbarStyle">@style/MDCToolbar</item>

```

**Minimal sample app repro:**
N/A

**Android API version:**
5.0 and above

**Material Library version:**
1.12.0

**Device:**
AVD/Emulators

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing the provided phone and tablet XML layouts together with the activity's WindowInsetsCompat listener and MaterialToolbar setup, then reproduce the behavior on Android 15 in portrait and landscape. Done means the MaterialToolbar has the correct height on phone devices in both orientations while the tablet layouts remain correct.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, kotlin
Domain
mobile
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.