[英]What style attribute do I use to change the color of an EditText's focused bottom line?
I'm trying to change the color of the bottom line from the focused EditText
in my style. 我正在尝试从样式中的聚焦
EditText
更改底线的颜色。
When I start editing text the color of the bottom line changes to a teal in the appcompat.Light
them. 当我开始编辑文本时,
appcompat.Light
底线的颜色变为蓝绿色。 I'm wondering what attribute this color comes from. 我想知道这种颜色来自什么属性。
Also I'm supporting back to API 14 so I can't use the tint colors. 另外,我还支持API 14,所以不能使用淡色。
You can change this color in xml with this line: 您可以使用以下行在xml中更改此颜色:
android:backgroundTint="@color/blue"
You can change it in code with something like: 您可以使用以下代码在代码中进行更改:
editText.getBackground().setColorFilter(getResources().getColor(R.color.blue), PorterDuff.Mode.SRC_ATOP);
You can also change this everywhere in your app by adding this line to you style in your themes.xml file: 您还可以通过在themes.xml文件中的样式中添加以下行来更改应用程序中的所有位置:
<item name="colorControlActivated">@color/blue</item>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.