[TextInputLayout] boxStrokeColor doesn't work with ColorStateLists for a variety of states.
See original GitHub issueDescription:
According to the documentation we can change the box color of a TextInputLayout
using the attribute boxStrokeColor
.
in truth, unless this is defined as a color selector, this only alter the focused color. It looks usually ok on white background but it’s really bad in dark background.
Instead the focused color change and the non focused color stay the default, which is
- default =
mtrl_textinput_default_box_stroke_color
- disabled =
mtrl_textinput_disabled_color
- hovered =
mtrl_textinput_hovered_box_stroke_color
Expected behavior:
the boxStrokeColor
should be taken and be used to generate defaultStrokeColor
, focusedStrokeColor
, hoveredStrokeColor
and disabledColor
according to https://material.io/design/interaction/states.html#anatomy
Source code:
<com.google.android.material.textfield.TextInputLayout
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:boxStrokeColor="#FFF"/>
Android API version: Any. We tried on P, Q.
Material Library version: 1.1.0-alpha10
Device: Pixel 2, Pixel 3
Issue Analytics
- State:
- Created 4 years ago
- Reactions:17
- Comments:25 (5 by maintainers)
Top Results From Across the Web
Change the TextInputLayout outline color - Stack Overflow
There are various ways to change TextInputLayout box stroke color and hint text color. The responsible attribute for box outline color is ...
Read more >TextInputLayout | Android Developers
Returns the text color used for the character counter, or null if one has not been set. ColorStateList, getDefaultHintTextColor(). Returns the ...
Read more >How To Change Bottom Line Color And Hint - ADocLib
I am using android design library's TextinputLayout.But couldn't customize the hint color label color and the underline color of EditText inside.
Read more >android.content.res.ColorStateList#isStateful
Source Project: material-components-android File: TextInputLayout.java License: ... getDefaultColor()) { // If attribute boxStrokeColor is not a color state ...
Read more >CardNumberTextInputLayout - Stripe Developer Resources
CardNumberTextInputLayout. @RestrictTo(value = [RestrictTo.Scope.LIBRARY_GROUP]). class CardNumberTextInputLayout : TextInputLayout. An TextInputLayout that ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Just overriding the
mtrl_textinput_default_box_stroke_color
value fixed it:<color name="mtrl_textinput_default_box_stroke_color" tools:override="true">#aaaaaa</color>
This is really a BAD idea.
mtrl_textinput_default_box_stroke_color
is not used only there.If you want to change the color right now create a color selector and use it to set the color: