material-components / material-components/material-components-android
[MaterialButton] Why Button rendering one more layer than TextView?
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 17.4k
- Forks
- 3.2k
- PR merge metrics
- No merged PRs in 30d
Description
**Description:** Sorry, maybe it's not a bug, I just don't understand and couldn't find any clue to explain it.
I wrote a demo to illuminate it.

According to [Official Site](https://developer.android.com/topic/performance/rendering/inspect-gpu-rendering), here's the result.
| Top => Bottom | Behavior |
|:----:|:----:|
|`OutlinedButton` ( background = TRANSPARENT )| Blue - Overdrawn 1 time |
|`TextButton` ( background = TRANSPARENT )| Blue - Overdrawn 1 time |
|`TextView`| No overdraw |
So
* What causes this?
* Is there any way to avoid this overdraw?
**Source code:**
```
```
**Android API version:** compileSdk 31
**Material Library version:** `com.google.android.material:material:1.6.1`
**Device:** Google Pixel 3 - Android 12
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
Start by reproducing the reported demo with Material Components 1.6.1 on Android 12/API 31, comparing the two MaterialButton styles with the TextView while GPU overdraw visualization is enabled. Review the supplied XML and determine what causes the extra layer and whether the transparent-background configuration can avoid it; done means documenting the cause and a supported workaround, if one exists.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- android
- Domain
- mobile
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100