BackgroundColor not working with Cordova/Android

0

The window background color for your app's MainActivity is grey on Android. It's appear a second before your splash screen. I would like to change it to black with Cordova.

I tried to use the cordova BackgroundColor property but it doesn't change anything:

<preference name="BackgroundColor" value="0x00000000"/>

Also, I found a plugin for that but in neither case it works:

https://www.npmjs.com/package/cordova-plugin-window-background

This is my package.json

{
  "name": "helloworld",
  "displayName": "HelloCordova",
  "version": "1.0.0",
  "description": "A sample Apache Cordova application that responds to the deviceready event.",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "keywords": [
    "ecosystem:cordova"
  ],
  "author": "Apache Cordova Team",
  "license": "Apache-2.0",
  "dependencies": {
    "cordova-android": "^8.1.0",
    "cordova-plugin-statusbar": "^2.4.3",
    "cordova-plugin-window-background": "1.1.2"
  },
  "devDependencies": {
    "cordova-plugin-whitelist": "^1.3.4"
  },
  "cordova": {
    "plugins": {
      "cordova-plugin-whitelist": {},
      "cordova-plugin-window-background": {
        "WINDOW_BACKGROUND_COLOR": "#000000"
      },
      "cordova-plugin-statusbar": {}
    },
    "platforms": [
      "android"
    ]
  }
}

And here my config.xml

<?xml version='1.0' encoding='utf-8'?>
<widget id="io.cordova.hellocordova" version="1.0.0" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
    <name>HelloCordova</name>
    <description>
        A sample Apache Cordova application that responds to the deviceready event.
    </description>
    <author email="dev@cordova.apache.org" href="http://cordova.io">
        Apache Cordova Team
    </author>
    <content src="index.html" />
    <plugin name="cordova-plugin-whitelist" spec="1" />
    <access origin="*" />
    <allow-intent href="http://*/*" />
    <allow-intent href="https://*/*" />
    <allow-intent href="tel:*" />
    <allow-intent href="sms:*" />
    <allow-intent href="mailto:*" />
    <allow-intent href="geo:*" />
    <preference name="BackgroundColor" value="0x00000000"/>
    <preference name="StatusBarBackgroundColor" value="#000000" />
    <platform name="android">
        <preference name="WINDOW_BACKGROUND_COLOR" default="#000000" />
        <allow-intent href="market:*" />
    </platform>
    <platform name="ios">
        <allow-intent href="itms:*" />
        <allow-intent href="itms-apps:*" />
    </platform>
</widget>

I'm removing and adding the platform to set the variables as well. Note that this is not related with any CSS.

Any help will be really appreciate : )

javascript
android
cordova
colors
background
asked on Stack Overflow Nov 26, 2019 by Chumpocomon

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0