设置Android Textcolor在5.0中被忽略但在6.0中有效 [英] Setting Android Textcolor being ignored for 5.0 but works for 6.0

查看:82
本文介绍了设置Android Textcolor在5.0中被忽略但在6.0中有效的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

将Android应用程序主题设置为Theme.AppCompat.NoActionBar,但在执行该操作时

Set the Android app theme as Theme.AppCompat.NoActionBar, but when I do

    android:textColor="@color/black"

对于xml布局中的TextView,颜色不会改变.

for a TextView in the xml layout, the color won't change.

但是,一切都适用于Android 6.0设备,但不适用于Android 5.0或4.0.3.

However, everything works fine for Android 6.0 devices, but it's not working for Android 5.0 or 4.0.3.

<uses-sdk
    android:minSdkVersion="8"
    android:targetSdkVersion="23" />

设置背景色效果很好.只是不同视图的文本颜色.

Setting background color works fine. It's just the text color of different views.

compile 'com.android.support:support-v4:+'
compile 'com.android.support:appcompat-v7:+'

推荐答案

如果您使用的是版本 v24.0.0 alpha1 + ,请返回到 v23.2.1 .关于在按钮,文本视图等上设置文本颜色的错误.

If you are using version v24.0.0 alpha1 or +, turn back to v23.2.1. There is a bug about setting text color on buttons, textviews etc.

使用:

compile 'com.android.support:appcompat-v7:23.2.1'

这篇关于设置Android Textcolor在5.0中被忽略但在6.0中有效的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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