material-components / material-components/material-components-android
[MaterialToolbar] Shadow is drawn over content with the same elevation
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 17.4k
- Forks
- 3.2k
- PR merge metrics
- No merged PRs in 30d
Description
**Description:** The shadow from a `MaterialToolbar` will draw over content below it even if it is of the same elevation. For example, if I have a `MaterialCardView` with `cardElevation=4dp` that is directly below a `MaterialToolbar` with `elevation=4dp`, there will be a shadow cast on the `MaterialCardView` from the `MaterialToolbar`.
**Expected behavior:** I would expect that there is no shadow over the card, since it is the same elevation as the app bar.
**Source code:** Modify `cat_topappbar_action_bar_activity.xml` from the catalog app so that the contents is within a `MaterialCardView`:
```xml
```
Then open the Action Bar Demo in the Catalog app.

**Android API version:** 31
**Material Library version:** 1.7.0-beta01
**Device:** Google Pixel 4a
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the issue by updating cat_topappbar_action_bar_activity.xml in the catalog app with the provided MaterialCardView, then open the Action Bar Demo. Trace how MaterialToolbar elevation and its shadow are rendered relative to the card. Done means content at the same 4dp elevation no longer receives a visible toolbar shadow.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- android, java
- Domain
- mobile-dev
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100