material-components / material-components/material-components-android
[TextInputLayout] Focused underline stroke can't be hidden in filled mode
@afohrman is already working on this.
Since Nov 10, 2022.
- Dominant language
- Java
- Stars
- 17.4k
- Forks
- 3.2k
- PR merge metrics
- No merged PRs in 30d
Description
**Description:**
TextInputLayout focused underline stroke can't be hidden in filled mode (`app:boxBackgroundMode="filled"`).
Our application design requires a filled mode TextInputLayout that has a stroke in unfocused state, and does not have a stroke in focused state. This was possible to achieve in Material Components version 1.3, but not in later versions (tested with 1.6 and 1.7).
**Expected behavior:**
Both of these approaches should hide the underline stroke in focused state:
1. `boxStrokeWidthFocused` is set to `0dp` (this solution used to work in version 1.3)
2. `boxStrokeColor` color state list entry for `state_focused` is set to transparent
**Source code:**
1. boxSrokeWidthFocused is ignored in filled mode, as separate drawables are now used instead: https://github.com/material-components/material-components-android/blob/release-1.7/lib/java/com/google/android/material/textfield/TextInputLayout.java#L4087
2. Default underline drawable is always drawn, and focused underline is drawn on top. Meaning that transparent boxStrokeColor shows the underlaying defaultStrokeColor instead: https://github.com/material-components/material-components-android/blob/release-1.7/lib/java/com/google/android/material/textfield/TextInputLayout.java#L2817
**Minimal sample app repro:** Please let me know if a sample would be useful.
**Android API version:** Any API version
**Material Library version:** 1.6, 1.7
**Device:** Any device
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.
Assessment
This issue has not been assessed yet.