通过插件cordova-plugin-splashscreen显示启动画面.但是,当应用程序启动并显示初始屏幕时,状态栏不会被隐藏.显示启动画面时如何隐藏状态栏?我找到了这个解决方案:
How to completely hide the status bar in iOS using Cordova?
但是它可以在iOS上运行.我的平台是Android.
解决方法:
在ionic 3应用中,如果< preference name =“ Fullscreen” value =“ true” />不起作用,请执行以下操作:
>安装全屏插件:
ionic cordova plugin add cordova-plugin-fullscreen
npm install --save @ionic-native/android-full-screen
<widget ... xmlns:android="http://schemas.android.com/apk/res/android"> // note this xmlns:android line
<platform name="android">
...
<edit-config file="AndroidManifest.xml" mode="merge" target="/manifest/application/activity">
<activity android:theme="@android:style/Theme.NoTitleBar.Fullscreen"/>
</edit-config>
</platform>
</widget>
>在src / app / app.module.ts中添加全屏提供程序:
....
// add this line at the top of the file, import it
import {AndroidFullScreen} from "@ionic-native/android-full-screen";
...
providers: [
StatusBar,
SplashScreen,
{provide: ErrorHandler, useClass: IonicErrorHandler},
AndroidFullScreen, // here add this line
...
]
>在src / app / app.components.ts中使用它:
// add this line at the top of the file, import it
import {AndroidFullScreen} from "@ionic-native/android-full-screen";
...
constructor(public platform: Platform,
public statusBar: StatusBar,
public splashScreen: SplashScreen,
public androidFullScreen: AndroidFullScreen) {
// show statusbar
this.androidFullScreen.isSupported()
.then(() => this.androidFullScreen.showsystemUI());
// style statusbar and hide splash
this.platform.ready().then(() => {
this.statusBar.styleDefault();
this.splashScreen.hide();
});
}
...
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。