android - 将状态栏项目(符号)的颜色更改为黑色

标签 android cordova ionic2 cordova-plugins ionic3

我可以为状态栏项目设置黑色吗?因为我需要将背景颜色更改为白色,如下所示。然后我看不到状态栏项目,因此它们也是白色。有什么帮助吗?

注意:我正在 Android 设备 (6.0) 上对此进行测试。

this.statusBar.styleDefault();
this.statusBar.backgroundColorByHexString("#fff");//white

现在(即白色元素):

enter image description here

我需要这样的(即黑色元素):

enter image description here

package.json

{
  "name": "ionic-hello-world",
  "version": "0.0.0",
  "author": "Ionic Framework",
  "homepage": "http://ionicframework.com/",
  "private": true,
  "scripts": {
    "clean": "ionic-app-scripts clean",
    "build": "ionic-app-scripts build",
    "ionic:build": "ionic-app-scripts build --prod",
    "ionic:serve": "ionic-app-scripts serve"
  },
  "dependencies": {
    "@angular/common": "4.1.3",
    "@angular/compiler": "4.1.3",
    "@angular/compiler-cli": "4.1.3",
    "@angular/core": "4.1.3",
    "@angular/forms": "4.1.3",
    "@angular/http": "4.1.3",
    "@angular/platform-browser": "4.1.3",
    "@angular/platform-browser-dynamic": "4.1.3",
    "@ionic-native/brightness": "^3.10.3",
    "@ionic-native/core": "3.12.1",
    "@ionic-native/facebook": "^3.5.0",
    "@ionic-native/network": "^3.11.0",
    "@ionic-native/splash-screen": "3.12.1",
    "@ionic-native/status-bar": "3.12.1",
    "@ionic/storage": "2.0.1",
    "cordova-android": "^6.2.3",
    "cordova-plugin-brightness": "^0.1.5",
    "cordova-plugin-facebook4": "^1.9.0",
    "cordova-plugin-statusbar": "~2.2.1",
    "cordova-plugin-whitelist": "^1.3.1",
    "ionic-angular": "3.4.2",
    "ionic-plugin-keyboard": "^2.2.1",
    "ionicons": "3.0.0",
    "lodash": "^4.17.4",
    "rxjs": "5.4.0",
    "sw-toolbox": "3.6.0",
    "zone.js": "0.8.12",
    "cordova-plugin-network-information": "~1.3.3"
  },
  "devDependencies": {
    "@ionic/app-scripts": "1.3.8",
    "@ionic/cli-plugin-cordova": "1.4.0",
    "@ionic/cli-plugin-ionic-angular": "1.3.1",
    "@types/nprogress": "0.0.29",
    "nprogress": "^0.2.0",
    "typescript": "2.3.3"
  },
  "cordovaPlugins": [
    "cordova-plugin-whitelist",
    "ionic-plugin-keyboard"
  ],
  "cordovaPlatforms": [],
  "description": "An Ionic project",
  "cordova": {
    "platforms": [
      "android"
    ],
    "plugins": {
      "cordova-plugin-whitelist": {},
      "ionic-plugin-keyboard": {},
      "cordova-plugin-brightness": {},
      "cordova-plugin-statusbar": {},
      "cordova-plugin-facebook4": {
        "APP_ID": "60",
        "APP_NAME": "app"
      },
      "cordova-plugin-network-information": {}
    }
  }
}

最佳答案

抱歉,styleDefault 仅适用于 ios 和 windows phone ( docs )

StatusBar.styleDefault
Use the default statusbar (dark text, for light backgrounds).

Supported Platforms
_ iOS
_ Windows Phone 7
_ Windows Phone 8
_ Windows Phone 8.1

也就是说,我认为您只能更改背景 颜色,但我想字体 颜色将基于此设置...我已更改多次修改状态栏背景色,使用深色,字体颜色自动设置为白色。

关于android - 将状态栏项目(符号)的颜色更改为黑色,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44737694/

相关文章:

android - 保存在目录中捕获的图像时 PhoneGap 文件 API 问题

java - Firebase 云通知导致应用程序崩溃

android - Volley 上下文中的 Kotlin 'it' 语法

ios - PhoneGap访问来源限制无效

java - 身份验证 Microsoft OneDrive REST 服务 Java/Ionic 2

angular - ionic 2 : EXCEPTION: No provider for NavController

angular - ngForm 和 FormGroup 的区别

android - 使用 Android 应用程序发送射频 (RF) 信号

android - 如何测试电池充电速度?

ios - cordova插件文件传输