gpt4 book ai didi

android - 如何让每个 Activity 都有不同颜色的 AppBar?

转载 作者:搜寻专家 更新时间:2023-11-01 09:47:28 24 4
gpt4 key购买 nike

我有一个主要 Activity qual touching 默认颜色 AppBar 颜色是棕色,但我想要一个次要 Activity ,该栏是绿色和一个黄色。使每个 Activity 都有不同的颜色。

这是我试过的:

它适用于所有 Activity

<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
</style>

我想只适用于一个但不知道它是如何工作的

<style name="CapAlumnes" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/botoAlumnes</item>
<item name="colorPrimaryDark">@color/botoAlumnes</item>
</style>

这是我得到的:

enter image description here

最佳答案

使用不同的主色和次色创建不同风格的主题。在 Android list 文件中将这些主题中的每一个设置为您的个人 Activity 。

<activity name="xyz" theme="styles/    mythemeColorGreen />

<activity name="xyd" theme="styles/ mythemeColorBlue />

关于android - 如何让每个 Activity 都有不同颜色的 AppBar?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37309532/

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