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

[TextInputLayout] Allow for attribute to determine if margin should be automatically included

Open
#1,869 0 comments 0 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.**
When trying to align a button next to a TextInputLayout with TextInputEditText in it in outline mode, it is near impossible to make it look appropriate if the two components are right next to each other due to the margin being included in the TextInputLayout to prevent the hint text from being partially hidden by other components.

**Describe the solution you'd like**
I would like an attribute to be able to indicate that the layout should not handle this margin as the layout that contains it will account for it

**Describe alternatives you've considered**
I've considered range from having the button and the text box appear misaligned and ignore it (this alternative is not the greatest). I've also considered (and this is what I have gone with) extending the TextInputLayout to remove the forced margin (this is also not ideal as it requires the use of reflection to get access to fields and methods that are private on TextInputLayout and it doesn't make sense to extend something in a way that removes something either)

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 in outline mode, focusing on the automatic margin described in the issue. Reproduce it with a TextInputEditText beside a button and verify that an opt-out attribute removes the automatic margin while default behavior remains unchanged.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.