material-components / material-components/material-components-android
[TextInputLayout] wrap the hint text
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 17.4k
- Forks
- 3.2k
- PR merge metrics
- No merged PRs in 30d
Description
When I set the hint text on TextInputLayout, it doesn't wrap the hint text when in wrap_content layout mode, like so:

I don't know if it's the intended result. But I want it expand the view and display the full hint text by default, like:

Currently my workaround is to add the same hint text to the child TextInputEditText and set android:textColorHint to transparent.
I searched and found this on Stackoverflow, but not finding an seemingly elegant way to achieve this. So may
I ask for an extra option or XML attribute if possible, to make the TIL wrap the hint text, or there can be a better way to do this?
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 reproducing the TextInputLayout hint behavior with wrap_content, comparing the TextInputLayout hint with the child TextInputEditText workaround described in the issue. No source file or test is named; done should mean a long hint expands and wraps in the layout without duplicating the hint or making it transparent.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- android
- Domain
- mobile
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100