Adam Greene
Adam Greene

Reputation: 827

Android - Setting background color to white comes out cyan

I am trying to set the default background color of all my Activities to white, but it doesn't seem to work properly on Jelly Bean (comes out cyan). I'm thinking it might be something with the V4 appcompat FragmentActivity (as standard Activities seem to be fine).

What I have done in styles.xml is this:

<style name="AppTheme" parent="@android:style/Theme.Holo.Light">
    <item name="android:windowBackground">@android:color/white</item>
    <item name="android:colorBackgroundCacheHint">@android:color/white</item>
    <item name="android:colorBackground">@android:color/white</item>
 </style>

Upvotes: 0

Views: 361

Answers (1)

manish
manish

Reputation: 497

In your resource folder under values create a new XML file called color.xml if it does not already exist. Then add a new colour to the colour xml file.

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <color name="white">#FFFFFF</color>
</resources>

remove "android:" in your xml and it should turn to white.

<style name="AppTheme" parent="@android:style/Theme.Holo.Light">
    <item name="android:windowBackground">@color/white</item>
    <item name="android:colorBackgroundCacheHint">@color/white</item>
    <item name="android:colorBackground">@color/white</item>
 </style>

Upvotes: 1

Related Questions