Skip to content

[TextInputLayout] Focused underline stroke can't be hidden in filled mode #3056

Open
@apoi

Description

@apoi

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

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions