将状态栏项目(符号)的颜色更改为黑色 [英] Change the color of Status bar items (symbols) to black

查看:452
本文介绍了将状态栏项目(符号)的颜色更改为黑色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

Can I give black color for the status bar items? Because I need to change the background color to white as shown below.Then I can't see the status bar items hence those are also white color.Any help?

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

Note: I'm testing this on Android device (6.0).

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

现在(即白色物品):

我需要这样(即黑色物品):

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

I'm sorry, but styleDefault is only available on ios and 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

话虽如此,我认为你只能改变背景颜色,但我想字体颜色将根据...设置...我已经多次使用深色更改了状态栏背景颜色,并且字体颜色自动设置为白色。

That being said, I think you can only change the background color, but I guess the font color will be set based on that... I've changed the status bar background color several times, using a dark color, and the font color was set to white automatically.

这篇关于将状态栏项目(符号)的颜色更改为黑色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆