I'd like to change the colour that flickers for a moment as an app is launching. I think it's determined by the overarching application theme, but I'd like to specify another colour.
To elaborate, I wouldn't like to modify the default background colour for all activities, specified by:
<item name="android:windowBackground">@color/red</item>
What's the most elegant way of achieving this?
Thanks for your time!
In /res/values
directory, modify your styles.xml
file to look like this:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="AppBaseTheme" parent="android:Theme.Holo.NoActionBar.Fullscreen">
<item name="android:windowBackground">@color/your_color</item>
</style>
</resources>
Now go to AndroidManifest.xml, and add the style to your activity launcher:
<activity
android:name=".Main"
android:theme="@style/AppBaseTheme" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
I saw a post of Google+ awhile ago. According to it, you can change the startup windows color by specifying it in your Theme.
On app launch, Android displays a simple preview window (based on your activity theme) as an immediate response to the user action. Then the preview window crossfades with your actual UI, once that has fully loaded. To ensure a smooth visual transition, your activity theme should match your full UI as closely as possible. The below image shows how the experience can be jarring if not handled properly.
For example, if your activity does not require an action bar, then disable it in your theme so that it doesn’t briefly appear in the preview window. To do this, use or extend an activity theme with no action bar. You can also override the background color of the window, if applicable, to better match your full UI.
<style name="AppBaseTheme" parent="android:Theme.Holo.NoActionBar">
<item name="android:windowBackground">@color/red</item>
</style>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With