androidkotlinintellij-ideamaterial-uimaterial-design

Changing the box stroke color of material design text input


I am creating an app using IntelliJ IDE and Kotlin. I have been trying to change the attribute,

app:boxStrokeColor

of my component,

com.google.android.material.textfield.TextInputLayout

But each time I have tried it ends up some default color of the Material Design Components library which has forced me to end up creating a resource in my

colors.xml 

file called,

<color name="mtrl_textinput_default_box_stroke_color" tools:ignore="PrivateResource">#E8E415</color>

But now that means I am only able to set this once and if I change it from this aforementioned color then it changes the instance everywhere.

I do know that I can create different drawables in order to achieve my desired affect but I wanted to know if there was a different way or better way then having to implement the drawables or the method of using

<color name="mtrl_textinput_default_box_stroke_color" tools:ignore="PrivateResource">#E8E415</color>

Without having to do it in my backend code each time or reusing a variable.

I have tried,

drawables <color name="mtrl_textinput_default_box_stroke_color" tools:ignore="PrivateResource">#E8E415</color> app:boxStrokeColor="#E8E415"


Solution

  • As at today, i don't think this has been fixed with material design. Last i checked, i faced same issue.