小编典典

覆盖默认的Android主题

java

我已经能够覆盖所有名称以“ android:”为前缀的主题,但是Android themes.xml还定义了似乎无法被覆盖的属性。例如:

<!-- Variation on the Light theme that turns off the title -->
<style name="Theme.Codebase" parent="android:style/Theme.Light">
    <item name="android:windowNoTitle">true</item>
    <item name="android:windowContentOverlay">@null</item>
    <item name="colorBackground">@color/off_white</item>
</style>

colorTheground是在Theme.Light xml中定义的,但是在此处添加它可以使我

/res/values/styles.xml:10: error: Error: No resource found that matches the given name: attr 'colorBackground'.

错误。如何为整个应用程序覆盖该样式?


阅读 307

收藏
2020-11-16

共1个答案

小编典典

您可以用修改属性(如)的方式覆盖标准属性windowNoTitle,只是不要忘记添加如下android:前缀:

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <style name="SEclubTheme" parent="@android:style/Theme">
        <item name="android:colorForeground">@color/bright_foreground_dark</item>
        <item name="android:colorBackground">@color/background_dark</item>
    </style>
</resources>
2020-11-16