material-components / material-components/material-components-android
[TextField] disabling hint prevents custom `defaultHintTextColor`
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 17.4k
- Forks
- 3.2k
- PR merge metrics
- No merged PRs in 30d
Description
Description:
I want to have textfield with disabled floating hint but with custom hint color for when the textfield is empty.
Let say i have a textfield with floating hint enabled.
I use setDefaultHintTextColor to change the hint color. It works and changes the color for expanded and collapsed.
Now i call setHintEnabled(false).
The floating hint gets disabled (expanded) but i still see the hint collapsed when there is no text (which is what i want).
However i loose the custom colors i set with setDefaultHintTextColor for when there is no text
Expected behavior: Screenshots and/or description of expected behavior
The setDefaultHintTextColor to be preserved while using setHintEnabled(false)
Source code: The code snippet which is causing this issue
Minimal sample app repro: Please consider attaching a minimal sample app that reproduces the issue. This will help narrow down the conditions required for reproducing the issue, and it will speed up the bug fix process. You may attach a zip file of the sample app or link to a GitHub repo that contains the sample app.
Android API version: 13, 11, 10
Material Library version: 1.11.0
Device: Emulator/real devices
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 with a minimal Android reproduction on Material Library 1.11.0, calling setDefaultHintTextColor and then setHintEnabled(false) on a textfield. Trace the TextField behavior around these two entry points across the listed Android API versions, and consider the issue done when the custom color remains visible for the collapsed hint while the floating hint stays disabled.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- android, java
- Domain
- mobile
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100