我有一个主活动Qual触摸默认颜色AppBar颜色是棕色,但我想第二个活动,酒吧是绿色和一个黄色。使每个活动都有不同的颜色。
这就是我尝试过的:
它适用于所有活动

<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>

这就是我得到的:
android - 如何使每个 Activity 都具有不同颜色的AppBar?-LMLPHP

最佳答案

用不同的主色和次色创建不同的主题。
将这些主题中的每一个设置为android清单文件中的单个活动。

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

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

10-05 21:13
查看更多