material-components / material-components/material-components-android
[TextInputLayout] Hint Expanded Gravity
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?**
The problem is that the hint gravity is always vertical centred. I've managed to centre the `TextInputEditText` text to bottom with styles, but I cannot achieve the same for the hint.
The problem is by the designs of the app I'm developing, the hing and the text are closer to the bottom `boxStroke` of filled Text Input with transparent background.
As you can see the attached images, the space between the bottom line and the hint in the second field is not as desired.
**Describe the solution you'd like**
I'd like to be able to set the expanded hint gravity to bottom from xml, styles or/and programmatically.
**Describe alternatives you've considered**
I've tried to use reflection to call `setExpandedTextGravity`, but it's not working. I can only change the collapsed gravity with reflection. I think that reflection will also not work in newer android versions.
**Additional context**
This is what I'm trying to achieve:

This is what I've managed to create:

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 from TextInputLayout and its existing expanded and collapsed hint-gravity behavior, then trace how gravity can be configured through XML, styles, or programmatic APIs. Done means the expanded hint can be aligned to the bottom consistently for the filled Text Input configuration described, without relying on reflection.
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