(材质)EditText下划线颜色 [英] (Material) EditText underline color

查看:291
本文介绍了(材质)EditText下划线颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的问题是我不知道如何更改EditText的下划线颜色-我有LG Nexus 5( Android 6 ).

My problem is that I don't know how to change underline color of EditText - I have LG Nexus 5 (Android 6).

我想将正常的下划线颜色更改为白色.我使用了所有 params ,例如(样式):

I would like to change normal underline color to white. I used all params like (style):

  • colorControlNormal
  • colorControlActivated
  • colorControlHighlight
  • textColorSecondary
  • colorPrimary
  • colorPrimaryDark

例如

<style name="FormFont" parent="@android:style/TextAppearance.Medium">
    <item name="android:textColor">@color/white</item>
    <item name="android:textSize">@dimen/form_text_size</item>
    <item name="colorControlNormal">#c5c5c5</item>
</style>

,但似乎没有任何效果(仅当EditText像上面的图片一样聚焦时,它才会更改颜色).

but nothing seems to work (it only changes color when EditText us focused like in above pic).

推荐答案

尝试使用android:backgroundTint="#yourUnderlineColor".

仅适用于API 21和更高版本.

Only available for API 21 and higher.

这篇关于(材质)EditText下划线颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆