gpt4 book ai didi

android - colorAccent 或 colorSecondary 与 Material Component 主题

转载 作者:行者123 更新时间:2023-11-29 22:40:47 47 4
gpt4 key购买 nike

当使用 Android Studio 向导创建新应用时,使用从 Theme.MaterialComponents.Light.DarkActionBar 派生的主题并设置 colorAccent。在另一边 official documentation使用 colorSecondary 并且根本不提及 colorAccent。两者可以互换吗?喜欢什么?

最佳答案

Theme.MaterialComponents 使用 colorSecondary,如 material guidelines 中所述在official doc .库中定义的所有组件都使用此属性。

然而,在图书馆里,也有Bridge themes它继承自 AppCompat 主题,如果您无法将主题更改为继承自 Material Components 主题,则可以使用它们。
这些主题继承自 AppCompat 主题,为您定义了新的 Material Components 主题属性。

您可以查看 bridge theme in the library :

<style name="Base.V14.Theme.MaterialComponents.Light" parent="Base.V14.Theme.MaterialComponents.Light.Bridge">

<!-- Colors -->
<item name="colorAccent">?attr/colorSecondary</item>

在这里您可以找到这些主题的 colorSecondarycolorAccent 之间的映射。

关于android - colorAccent 或 colorSecondary 与 Material Component 主题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59022223/

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