gpt4 book ai didi

android - API <22 的颜色选择器中的主题属性

转载 作者:行者123 更新时间:2023-11-30 05:05:12 25 4
gpt4 key购买 nike

我有几个这样的颜色选择器

<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:color="?attr/colorAccent" android:state_checked="true"/>
<item android:color="@android:color/white" android:state_checked="false"/>
</selector>

这些颜色选择器适用于 API 23 及更高版本。对于 API 22 ?attr/colorAccent 似乎不起作用。我总是看到 Red 颜色。这在未用于 selector 时有效。理想情况下,它应该适用于 API 21+

最佳答案

这是 Pre-Lollipop 的预期行为,因为它是在 Lollipop 中添加的(参见 here)。为了兼容性,您可以为多个主题的可绘制对象创建多个文件。

关于android - API <22 的颜色选择器中的主题属性,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54685474/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com