Android colorControlNormal xml属性在棒棒糖之前不起作用 [英] Android colorControlNormal xml attributes doesn't work pre-Lollipop
问题描述
我一直在尝试更改底部的EditText
行的颜色,但是我的EditText
仍然不想更改颜色,但是它使用的是Material
中的样式.
I've been trying to change the color of the EditText
line on the bottom, but my EditText
still doesn't wanna change the color, but it's using the style from Material
.
我尝试按照以下答案更改颜色:链接
I've tried to change the color following these answer: link
所以我有一个EditText
,具有Material
形式,但是没有设置的颜色.
So I have an EditText
with the Material
form but not the colors I've set.
我已将appcompat-v7
放入我的Gradle
配置文件中,并且已经可以用于原色.
I've put appcompat-v7
in my Gradle
config file, and it's already working for the color primary.
<style name="AppBaseTheme.MiddleTheme.Widget.EditText" parent="Theme.AppCompat.Light">
<item name="colorPrimary">@color/middle_primary</item>
<!-- Those 3 lines are staying in red war in IntelliJ but it does build the project -->
<item name="android:colorControlNormal">@color/middle_sqool_primary</item>
<item name="android:colorControlActivated">@color/middle_sqool_primary</item>
<item name="android:colorControlHighlight">@color/middle_sqool_primary</item>
</style>
推荐答案
您必须在 app主题(或活动主题)中设置colorControlActivated
,colorControlHighlight
和colorControlNorma
l而不是您的edittext样式.
You have to set the colorControlActivated
, colorControlHighlight
and colorControlNorma
l in your app theme (or activity theme) not in your edittext style.
类似这样的东西:
<style name="Theme.App.Base" parent="Theme.AppCompat.Light">
<item name="colorControlNormal">@color/middle_sqool_primary</item>
<item name="colorControlActivated">@color/middle_sqool_primary</item>
<item name="colorControlHighlight">@color/middle_sqool_primary</item>
</style>
这篇关于Android colorControlNormal xml属性在棒棒糖之前不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!