How to change material TextInputLayout OutlinedBox unfocused Color

后端 未结 1 1684
抹茶落季
抹茶落季 2021-02-03 15:46

I have an OutlinedBox TextInputLayout and I want to change the box color in the unfocused mode of editText.

How can I do that?

1条回答
  •  梦谈多话
    2021-02-03 16:24

    In the theme Add colorOnSurface attribute and assign any color you want

    
    

    The result is: Also colorPrimary is the color of focused state.

    Other attributes you can customize are:

    true
    true
    
    outline
    @null
    @color/mtrl_outline_end_icon_tint
    0dp
    @dimen/mtrl_textinput_box_corner_radius_medium
    @dimen/mtrl_textinput_box_corner_radius_medium
    @dimen/mtrl_textinput_box_corner_radius_medium
    @dimen/mtrl_textinput_box_corner_radius_medium
    @color/mtrl_outlined_stroke_color
    
    ?attr/textAppearanceCaption
    ?attr/textAppearanceCaption
    ?attr/textAppearanceCaption
    ?attr/textAppearanceCaption
    ?attr/textAppearanceCaption
    
    @color/mtrl_indicator_text_color
    @color/mtrl_error
    @color/mtrl_error
    @color/mtrl_indicator_text_color
    
    ?attr/colorPrimary
    
    @color/mtrl_indicator_text_color
    
    ?attr/shapeAppearanceSmallComponent
    @null
    

    0 讨论(0)
提交回复
热议问题