Android colorControlNormal xml属性在棒棒糖之前不起作用 [英] Android colorControlNormal xml attributes doesn't work pre-Lollipop

本文介绍了Android colorControlNormal xml属性在棒棒糖之前不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在尝试更改底部的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主题(或活动主题)中设置colorControlActivatedcolorControlHighlightcolorControlNorma l而不是您的edittext样式.

You have to set the colorControlActivated, colorControlHighlight and colorControlNormal 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屋!

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