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

[Widget.Material3.Badge] Badge in TabLayout overlaps text

Open
#2,560 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug Issue: Design Spec Mismatch Widget: Badge
Dominant language
Java
Stars
17.4k
Forks
3.2k
PR merge metrics
No merged PRs in 30d

Description

**Description:** Material 3 appears to have regressed [this](https://github.com/material-components/material-components-android/issues/475) issue. A badge containing numbers overlaps the text so much that it obscures the last letter of the label.

image

**Expected behavior:** The label should not be obscured

**Source code:**

_activity_main.xml_
```

```

_MainActivity.kt - onCreate_
```
TabLayoutMediator(tabs, viewPager) { tab, position ->
val badge = tab.getOrCreateBadge()
badge.number = 1
tab.text = resources.getString(TAB_TITLES[position])
}.attach()
```

**Android API version:** Tested on API 29

**Material Library version:** com.google.android.material:material:1.5.0

**Device:** AVD - Nexus 4

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

Reproduce the overlap using activity_main.xml and the MainActivity.kt onCreate code with TabLayoutMediator, API 29, and Material 1.5.0. Start by inspecting the TabLayout badge and tab-label behavior; done means numeric badges no longer obscure the final character of tab labels.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, kotlin
Domain
mobile-dev
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.