AppCompat and EditText different underline on different API

前端 未结 2 685
旧时难觅i
旧时难觅i 2021-01-05 08:05

I\'m trying to make underline line color change for EditText (it will be used for input\'s validation, so it must be able to change in runtime).

I\'m u

2条回答
  •  盖世英雄少女心
    2021-01-05 08:38

    You should not change the background. It's better if you create a theme, and use theme colors (colorPrimary, colorAccent are the most important for widgets) to get the desired effect. Assign the theme to your EditText and enjoy. Note: you should use one of the AppCompat theme as base theme.

    
    

    and in your colors.xml

    #ff0000
    #00ff00
    

提交回复
热议问题