属性android:colorForeground在API 23中不起作用 [英] Attribute android:colorForeground not working in API 23
问题描述
通过在主题中设置android:colorForeground
,将基于此设置(即android:textColorPrimary
和android: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屋!