属性android:colorForeground在API 23中不起作用 [英] Attribute android:colorForeground not working in API 23

查看:388
本文介绍了属性android:colorForeground在API 23中不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

通过在主题中设置android:colorForeground,将基于此设置(即android:textColorPrimaryandroid:textColorSecondary)计算主要文本颜色.

By setting android:colorForeground in the theme, the main text colours are calculated based on this setting, i.e. android:textColorPrimary and android:textColorSecondary.

我已经使用API​​ 23和API 27对此进行了测试.在API 23中,它不起作用,并且文本颜色基于白色.在API 27中,它按预期运行.

I have tested this with API 23 and API 27. In API 23 it is not working and the text colours are based on white. In API 27 it is working as expected.

  • 这是一个已知的错误吗?
  • 有一个简单的解决方法吗?
  • 该错误在不同版本的API上的扩展程度如何?

非常感谢您.

推荐答案

据我所知,这是Android Studio的问题. Layout Editor显示了API 23的颜色计算行为,似乎可以从API 26开始使用.

As far as I can tell this is rather an issue of Android Studio. The Layout Editor is showing a color calculation behaviour for API 23, wich seems to be available from API 26 onwards.

颜色需要属性primaryContentAlpha,该属性可用于API26.

The color requires an attribute primaryContentAlpha which is available for API 26.

我仍然必须找出低级API的后备行为,以及是否可以通过支持库进行修复.

I still have to find out, how the fallback behaves for lower API and if I can fix this by a support library.

请参阅: API 26的文本颜色行为支持库?

这篇关于属性android:colorForeground在API 23中不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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