我有一款Ionic混合移动应用程序。 在最近的构建之后,我注意到我的应用程序在启动后无缘无故地全屏显示(状态栏可见)。第一个视图是Google Map,当它加载时,ionic.Platform.fullScreen(false,true);叫做。这是因为如果用户第一次打开应用程序,则显示全屏显示,然后用户导航到地图,该地图不应该是全屏的。如果发生这种转换(介绍被打开)一切都很好,但是如果用户打开应用程序第二个+时间(没有介绍),那么地图会全屏显示,状态栏可见,所以标题的一半被覆盖。
仅在Android上发生这种情况。我最近升级了Cordova CLI版本,cordova-andoid版本(因为缺少splashscreen bug)以及Linux版本。从cordova尝试了许多:6.0.0,6.4.0,6.5.0; cordova-android:6.0.0,6.2.1。,6.2.2,6.2.3
首先,我认为这与我的构建方式有关,但现在事实证明这并非完全正确。
当前设置:
Cordova CLI: 6.0.0
Gulp version: CLI version 3.9.1
Gulp local: Local version 3.9.1
Ionic Framework Version: 1.3.0
Ionic CLI Version: 1.7.16
Ionic App Lib Version: 0.7.3
OS: Distributor ID: Ubuntu Description: Ubuntu 17.04
Node Version: v4.4.0
非常感谢任何帮助!
更新: 我的config.xml
<?xml version='1.0' encoding='utf-8'?>
<widget id="com.myapp" version="0.8.2" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<name>MyApp</name>
<description>
My desc.
</description>
<author email="developers@me.com" href="http://myapp.com/">
MyApp Co.
</author>
<content src="index.html" />
<access origin="*" />
<access launch-external="yes" origin="tel:*" />
<allow-intent href="tel:*" />
<plugin name="Geolocation" value="CDVLocation" />
<plugin name="cordova-plugin-network-information" spec="~1.2.1" />
<preference name="webviewbounce" value="false" />
<preference name="UIWebViewBounce" value="false" />
<preference name="DisallowOverscroll" value="true" />
<preference name="android-minSdkVersion" value="16" />
<preference name="BackupWebStorage" value="none" />
<preference name="SplashScreen" value="screen" />
<preference name="SplashScreenDelay" value="7000" />
<preference name="FadeSplashScreenDuration" value="1000" />
<preference name="xwalkVersion" value="19+" />
<preference name="xwalkCommandLine" value="--disable-pull-to-refresh-effect" />
<preference name="xwalkMode" value="embedded" />
<preference name="xwalkMultipleApk" value="true" />
<preference name="StatusBarStyle" value="default" />
<feature name="StatusBar">
<param name="ios-package" onload="true" value="CDVStatusBar" />
</feature>
<hook src="hooks/before_build/010_some_hook.js" type="before_build" />
<hook src="hooks/after_prepare/020_other_hook.js" type="after_prepare" />
<platform name="android">
<splash density="port-ldpi" src="resources/android/splash/drawable-port-ldpi-screen.png" />
<splash density="port-mdpi" src="resources/android/splash/drawable-port-mdpi-screen.png" />
<splash density="port-hdpi" src="resources/android/splash/drawable-port-hdpi-screen.png" />
<splash density="port-xhdpi" src="resources/android/splash/drawable-port-xhdpi-screen.png" />
<splash density="port-xxhdpi" src="resources/android/splash/drawable-port-xxhdpi-screen.png" />
<splash density="port-xxxhdpi" src="resources/android/splash/drawable-port-xxxhdpi-screen.png" />
<icon density="ldpi" src="resources/android/icon/drawable-ldpi-icon.png" />
<icon density="mdpi" src="resources/android/icon/drawable-mdpi-icon.png" />
<icon density="hdpi" src="resources/android/icon/drawable-hdpi-icon.png" />
<icon density="xhdpi" src="resources/android/icon/drawable-xhdpi-icon.png" />
<icon density="xxhdpi" src="resources/android/icon/drawable-xxhdpi-icon.png" />
<icon density="xxxhdpi" src="resources/android/icon/drawable-xxxhdpi-icon.png" />
</platform>
<platform name="ios">
<splash height="1136" src="resources/ios/splash/Default-568h@2x~iphone.png" width="640" />
<splash height="1334" src="resources/ios/splash/Default-667h.png" width="750" />
<splash height="2208" src="resources/ios/splash/Default-736h.png" width="1242" />
<splash height="2048" src="resources/ios/splash/Default-Portrait@2x~ipad.png" width="1536" />
<splash height="2732" src="resources/ios/splash/Default-Portrait@~ipadpro.png" width="2048" />
<splash height="1024" src="resources/ios/splash/Default-Portrait~ipad.png" width="768" />
<splash height="960" src="resources/ios/splash/Default@2x~iphone.png" width="640" />
<splash height="480" src="resources/ios/splash/Default~iphone.png" width="320" />
<icon height="57" src="resources/ios/icon/icon.png" width="57" />
<icon height="114" src="resources/ios/icon/icon@2x.png" width="114" />
<icon height="40" src="resources/ios/icon/icon-40.png" width="40" />
<icon height="80" src="resources/ios/icon/icon-40@2x.png" width="80" />
<icon height="120" src="resources/ios/icon/icon-40@3x.png" width="120" />
<icon height="50" src="resources/ios/icon/icon-50.png" width="50" />
<icon height="100" src="resources/ios/icon/icon-50@2x.png" width="100" />
<icon height="60" src="resources/ios/icon/icon-60.png" width="60" />
<icon height="120" src="resources/ios/icon/icon-60@2x.png" width="120" />
<icon height="180" src="resources/ios/icon/icon-60@3x.png" width="180" />
<icon height="72" src="resources/ios/icon/icon-72.png" width="72" />
<icon height="144" src="resources/ios/icon/icon-72@2x.png" width="144" />
<icon height="76" src="resources/ios/icon/icon-76.png" width="76" />
<icon height="152" src="resources/ios/icon/icon-76@2x.png" width="152" />
<icon height="167" src="resources/ios/icon/icon-83.5@2x.png" width="167" />
<icon height="29" src="resources/ios/icon/icon-small.png" width="29" />
<icon height="58" src="resources/ios/icon/icon-small@2x.png" width="58" />
<icon height="87" src="resources/ios/icon/icon-small@3x.png" width="87" />
</platform>
<icon src="resources/android/icon/drawable-xhdpi-icon.png" />
<plugin name="cordova-plugin-fcm" spec="~2.1.1" />
<plugin name="cordova-plugin-inappbrowser" spec="~1.7.0" />
<engine name="android" spec="~6.2.1" />
<engine name="ios" spec="~4.3.1" />
<plugin name="cordova-plugin-facebook4" spec="~1.7.4">
<variable name="APP_ID" value="myid" />
<variable name="APP_NAME" value="MyApp" />
</plugin>
</widget>
我们使用的插件列表:
"cordovaPlugins": [
"cordova-plugin-geolocation",
"cordova-plugin-whitelist",
"cordova-plugin-crosswalk-webview",
"cordova-plugin-splashscreen",
"cordova-plugin-statusbar",
"cordova-plugin-fcm",
"uk.co.workingedge.phonegap.plugin.launchnavigator",
"cordova-plugin-x-toast",
{
"variables": {
"FABRIC_API_KEY": "mykey",
"FABRIC_API_SECRET": "mysecret"
},
"locator": "cordova-fabric-plugin@1.1.1",
"id": "cordova-fabric-plugin@1.1.1"
},
"cordova-plugin-device",
"cordova-plugin-network-information",
"cordova-plugin-inappbrowser",
{
"variables": {
"APP_ID": "myid",
"APP_NAME": "myapp"
},
"locator": "cordova-plugin-facebook4",
"id": "cordova-plugin-facebook4"
},
"cordova-plugin-screen-orientation"
]
答案 0 :(得分:2)
在config.xml上设置此首选项<preference name="StatusBarOverlaysWebView" value="false" />
,或在设备就绪事件后使用此代码StatusBar.overlaysWebView(false);
可能会解决您的问题。