material-components / material-components/material-components-android
[TabLayout] Add XML attribute for scrollableTabMinWidth
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 17.4k
- Forks
- 3.2k
- PR merge metrics
- No merged PRs in 30d
Description
**Is your feature request related to a problem? Please describe.**
I'm attempting to get centered, scrollable tabs with NO minimum width. However, it seems that a minimum width is added to each tab when `tabMode="scrollable"`.
**Describe the solution you'd like**
I'd like to be able to remove, or set the minimum width to zero. There's possibly already a TODO for this on Line 570 of the class.
**Describe alternatives you've considered**
I've tried different combinations of `tabMode` and `tabGravity`:
```
// 1 This produces the desired visual result when tab labels are smaller than screen width (pictured)
// but results in multi-line tabs when the labels are wider than the screen width.
tabMode="fixed"
tabGravity="start"
```

```
// 2 These seem to be the desired attribute values, but a minimum width is applied to each tab.
tabMode="scrollable"
tabGravity="center"
```

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 in the TabLayout class at the TODO around line 570 and trace how the minimum width is applied when tabMode="scrollable". Add the requested XML attribute so the minimum can be set to zero, then verify that centered scrollable tabs no longer receive the unwanted minimum width.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- mobile
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100