Thursday, 27 August 2015

android, change background color of all activities



1. add "android:background="#ffffffff"" to the root xml of all your layouts.

2. use code to change programmatically in all activities.

3. use style:

In you AndroidManifest.xml file, most of you should have this:



And you should have a styles.xml file under res/values:




It should have nothing, but just:

<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">

So that's why you got a black action bar...

Then change it to:


<resources>
    <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
        <item name="android:windowBackground">@color/background</item>
    </style>
</resources>

Then add this into your strings.xml:

<color name="background">#bbff2a</color>


http://stackoverflow.com/questions/10156816/android-how-to-set-background-color-of-all-screens

No comments:

Post a comment