覆盖默认的Android主题

typ*_*ror 10 java android

我已经能够覆盖任何名称前缀为"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>
Run Code Online (Sandbox Code Playgroud)

colorBackground在Theme.Light xml中定义,但是在这里添加它给了我一个

/res/values/styles.xml:10: error: Error: No resource found that matches the given name: attr 'colorBackground'.
Run Code Online (Sandbox Code Playgroud)

错误.如何覆盖整个应用程序的样式?

Mal*_*olm 9

您可以像修改这些属性一样覆盖标准属性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>
Run Code Online (Sandbox Code Playgroud)