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:
-
boxStrokeWidthFocused
is set to0dp
(this solution used to work in version 1.3) -
boxStrokeColor
color state list entry forstate_focused
is set to transparent
Source code:
-
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
-
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