material-components / material-components/material-components-android
[TabLayout] Ability to change the textAppearance based on the selection state of a Tab
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.**
We have a requirement that wants us to be able to change the textappearance of a tab based on it's selection state. We can change text color as it uses a state selector to manage this, but are unable to change the fonts, letter spacing, or text size by setting a selector.
The only way seems to be to do this programatically instead of being able to style these changes.
**Describe the solution you'd like**
it would be nice to have something like **textAppearanceUnselected** or something similar that would allow setting the textAppearance of a tab when it is in an unselected state. The regular textAppearance attribute can be used for the selected state or if there isn't an unselected attribute set.
**Describe alternatives you've considered**
We are considering listening to the tab selection events, and adjusting, but this may not necessarily work as well as it can't be driven by a Theme Overlay in which case the states could be changed based on business rules that cause the theme to change as well.
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 locating the TabLayout implementation and its tab text styling and selection-state handling. Review how the existing textAppearance and stateful text color behavior are applied. Done means unselected tabs can receive a separate text appearance while the regular appearance remains the selected-state fallback, with appropriate coverage for the new behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- android, java
- Domain
- design, mobile
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100