Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/213.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 启动屏幕中的离子状态栏颜色_Android_Ionic Framework - Fatal编程技术网

Android 启动屏幕中的离子状态栏颜色

Android 启动屏幕中的离子状态栏颜色,android,ionic-framework,Android,Ionic Framework,我正在使用ionic 3开发一个简单的应用程序,该应用程序正在运行,但在启动屏幕期间状态栏出现问题,它是黑色的,我想将颜色更改为启动屏幕的相同蓝色 我尝试了Ionic Native-Splash Screen,它改变了状态栏的颜色,但是在启动屏幕之后 这是密码 initializeApp() { this.platform.ready().then(() => { this.statusBar.overlaysWebView(false); this.s

我正在使用ionic 3开发一个简单的应用程序,该应用程序正在运行,但在启动屏幕期间状态栏出现问题,它是黑色的,我想将颜色更改为启动屏幕的相同蓝色

我尝试了Ionic Native-Splash Screen,它改变了状态栏的颜色,但是在启动屏幕之后

这是密码

initializeApp() {
    this.platform.ready().then(() => {


      this.statusBar.overlaysWebView(false);
      this.statusBar.backgroundColorByHexString('#002e5b');
      this.keyboard.disableScroll(true);
    });
  }
有没有办法做到这一点?谢谢。

平台加载时将显示启动屏幕。 平台就绪时,状态栏颜色将为002e5b

我认为在使用此方法之前无法访问平台。this.platform.ready。

平台加载时将显示启动屏幕。 平台就绪时,状态栏颜色将为002e5b


我认为在使用此方法之前无法访问平台this.platform.ready。

我也有同样的问题。我用叉子把它固定住了:

安装此拨叉:

ionic cordova plugin rm cordova-plugin-splashscreen
ionic cordova plugin add https://github.com/goinnn/cordova-plugin-splashscreen.git#4.0.0#colors
如果出现此错误:

Probably this is either a connection problem, or plugin spec is incorrect.
Check your connection and plugin name/version/URL.
还有一次,它非常疯狂:

ionic cordova plugin add https://github.com/goinnn/cordova-plugin-splashscreen.git#4.0.0#colors
在config.xml中:

<platform name="android">
    <preference name="SplashStatusBarBackgroundColor" value="#YOUR_COLOR" />
    <preference name="SplashNavigationBarBackgroundColor" value="#YOUR_COLOR" />

我也有同样的问题。我用叉子把它固定住了:

安装此拨叉:

ionic cordova plugin rm cordova-plugin-splashscreen
ionic cordova plugin add https://github.com/goinnn/cordova-plugin-splashscreen.git#4.0.0#colors
如果出现此错误:

Probably this is either a connection problem, or plugin spec is incorrect.
Check your connection and plugin name/version/URL.
还有一次,它非常疯狂:

ionic cordova plugin add https://github.com/goinnn/cordova-plugin-splashscreen.git#4.0.0#colors
在config.xml中:

<platform name="android">
    <preference name="SplashStatusBarBackgroundColor" value="#YOUR_COLOR" />
    <preference name="SplashNavigationBarBackgroundColor" value="#YOUR_COLOR" />

如果使用单一颜色作为背景的飞溅,请将状态栏颜色更改为相同

对于Android,在styles.xml中添加以下内容,我将以白色背景显示状态栏

@android:彩色/白色 @android:彩色/白色
如果使用单一颜色作为背景的飞溅,请将状态栏颜色更改为相同

对于Android,在styles.xml中添加以下内容,我将以白色背景显示状态栏

@android:彩色/白色 @android:彩色/白色
我不知道这是不是正确的方法,但我没有找到另一种方法

这就是我所做的:

1-我删除了闪屏插件并再次添加了它,但这次是这个fork

爱奥尼亚科尔多瓦插件添加

2-然后在这个路径中:platforms\android\app\src\main\java\org\apache\cordova\splashscreen.java

更改以下代码行:

 // Inspirated in https://github.com/apache/cordova-plugin-splashscreen/pull/124/files
            String statusBarColor = preferences.getString("SplashStatusBarBackgroundColor", "#000000");

            if (statusBarColor != null && !statusBarColor.isEmpty() && Build.VERSION.SDK_INT >= 19) {

                splashWindow.clearFlags(0x04000000);
                splashWindow.addFlags(0x80000000);
                try {
                    // Using reflection makes sure any 5.0+ device will work without having to compile with SDK level 21
                    splashWindow.getClass().getMethod("setStatusBarColor", int.class).invoke(splashWindow, Color.parseColor(statusBarColor));
                } catch (Exception ignore) {
                    // this should not happen, only in case Android removes this method in a version > 21
                    LOG.w("SplashScreen StatusBarColor", "Method window.setStatusBarColor not found for SDK level " + Build.VERSION.SDK_INT);
                }
            }
3-在config.xml文件中添加此首选项:

<preference name="SplashStatusBarBackgroundColor" value="#50ABC5" />

是的,这对我很有效。

我不知道这是不是正确的方法,但我没有找到其他方法

这就是我所做的:

1-我删除了闪屏插件并再次添加了它,但这次是这个fork

爱奥尼亚科尔多瓦插件添加

2-然后在这个路径中:platforms\android\app\src\main\java\org\apache\cordova\splashscreen.java

更改以下代码行:

 // Inspirated in https://github.com/apache/cordova-plugin-splashscreen/pull/124/files
            String statusBarColor = preferences.getString("SplashStatusBarBackgroundColor", "#000000");

            if (statusBarColor != null && !statusBarColor.isEmpty() && Build.VERSION.SDK_INT >= 19) {

                splashWindow.clearFlags(0x04000000);
                splashWindow.addFlags(0x80000000);
                try {
                    // Using reflection makes sure any 5.0+ device will work without having to compile with SDK level 21
                    splashWindow.getClass().getMethod("setStatusBarColor", int.class).invoke(splashWindow, Color.parseColor(statusBarColor));
                } catch (Exception ignore) {
                    // this should not happen, only in case Android removes this method in a version > 21
                    LOG.w("SplashScreen StatusBarColor", "Method window.setStatusBarColor not found for SDK level " + Build.VERSION.SDK_INT);
                }
            }
3-在config.xml文件中添加此首选项:

<preference name="SplashStatusBarBackgroundColor" value="#50ABC5" />


是的,这对我很有用。

所以,没有办法改变颜色??不。当平台准备好时,你可以改变状态栏的颜色,就是这样。就是这样。。。如果不更改cordova插件splashscreen插件。几乎从来就不是这样developing@HéctorPérezSilva按照Goin answer的指示,告诉我们它是如何工作的。谢谢你的解决方案。我在回答中添加了一个屏幕截图。所以,没有办法更改颜色??不。当平台准备就绪时,你可以更改状态栏的颜色,就这样。就这样。。。如果不更改cordova插件splashscreen插件。几乎从来就不是这样developing@HéctorPérezSilva按照Goin answer的指示,告诉我们它是如何工作的。谢谢你的解决方案。我在回答中添加了一个屏幕截图。我试过了,没有任何区别,仍然是黑色状态栏。你确定你在使用4.0.0颜色分支吗?这对我来说太好了。我把它们放错了吗?我想你没有用我的叉子。这是我的工作。@terpo完成了!我编辑了我的答案。这很简单:-我试过了,没有任何区别,仍然是黑色状态栏你确定你在使用4.0.0颜色分支吗?这对我来说太好了。我把它们放错了吗?我想你没有用我的叉子。这是我的工作。@terpo完成了!我编辑了我的答案。这很容易:-