Issue: change border color or box stroke for unfocused TextInputLayout in android

If you want to set the color for the outline box in unfocused mode instead of the default black, you have to add this line in colors.xml file which will override the default color for the outline box.

copy this line as it is. you can change color to what you want.

<color name="mtrl_textinput_default_box_stroke_color">#fff</color>

until now it will work, for more control on TextInputLayout you may add this style in styles.xml

<style name="TextInputLayoutStyle" parent="Widget.MaterialComponents.TextInputLayout.OutlinedBox.Dense">
    <item name="boxStrokeColor">#fff</item>
    <item name="boxStrokeWidth">2dp</item>
</style>

then add theme to TextInputLayout

android:theme="@style/TextInputLayoutStyle"

Leave a Comment