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

[TextInputLayout] Allow setting the hint expanded and collapsed color independently of the focus state

Open
#1,169 3 comments 5 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

feature request Widget: TextField
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.**

Right now it's not possible to set a fixed color for the collapsed hint, and a fixed color for the expanded hint. Based on the current API and styles available, we can only set the hint text color for when there's focus, and for when there isn't.

The [current documentation](https://material.io/develop/android/components/text-fields/) says that `app:hintTextColor` controls the "Collapsed (floating) color", but that's not the case -- it actually controls the color of the hint for when the field has focus.

**Describe the solution you'd like**

One solution would be to expose a way to call `setCollapsedTextColor()` and `setExpandedTextColor()` from the `CollapsingTextHelper` that lives within `TextInputLayout`. Ideally we'd be able to control that with styles as well. But any way that allows us to decouple the hint color from the focus would work.

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

Start with TextInputLayout and its CollapsingTextHelper, then inspect how app:hintTextColor currently maps to focus state. Confirm the existing documentation behavior and identify the relevant style attributes or APIs; done means expanded and collapsed hint colors can be configured independently of focus.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, java
Domain
mobile
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.