material-components / material-components/material-components-android
[TextInputLayout] Apply different gravities to `app:prefixText`
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.**
As of right now, you can't make a `TextInputLayout` center its content (including the underlying prefix and `TextInputEditText`). You can certainly center the TIET by calling `android:gravity=center` on it, but invoking that on the TIL does...nothing 😂
**Describe the solution you'd like**
The TIL seems to stack the "start" content (prefix, icon) from the `start` side. I think that's a super reasonable default, but having some way to configure a different gravity to the start content (in my specific case, `app:prefixText`) would be super useful.
**Additional context**
This is the screen I'm trying to build:

If I want my content centered _and_ I want to have a prefix, I basically have to roll my own fancy EditText.
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 TextInputLayout's handling of app:prefixText and the interaction with TextInputEditText's android:gravity; the issue names no files or tests. Define how configurable gravity should apply to the prefix and other start content while preserving the current default, then verify that centered content with a prefix works as requested.
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
- 38/100