Android Cordova在屏幕显示期间隐藏状态栏
Splashscreen由插件cordova插件Splashscreen显示。但当应用程序启动并显示splashscreen时,状态栏不会隐藏。显示splashscreen时如何隐藏状态栏?我找到了这个解决方案: 但这是iOS上的工作。我的平台是Android。在爱奥尼亚3应用程序中,如果Android Cordova在屏幕显示期间隐藏状态栏,android,cordova,cordova-plugins,Android,Cordova,Cordova Plugins,Splashscreen由插件cordova插件Splashscreen显示。但当应用程序启动并显示splashscreen时,状态栏不会隐藏。显示splashscreen时如何隐藏状态栏?我找到了这个解决方案: 但这是iOS上的工作。我的平台是Android。在爱奥尼亚3应用程序中,如果不起作用,请执行以下操作: 安装全屏插件: ionic cordova plugin add cordova-plugin-fullscreen npm install --save @ionic-nativ
不起作用,请执行以下操作:
ionic cordova plugin add cordova-plugin-fullscreen
npm install --save @ionic-native/android-full-screen
config.xml
文件中以自定义主题:
<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.components.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
...
]
// 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();
});
}
...
对于Android,如果你有一个单色背景的飞溅,请将状态栏更改为相同的颜色 在
styles.xml
中添加以下内容(我用白色背景显示状态栏)
@android:彩色/白色
@android:彩色/白色
的工作原理类似于charm+1,但我需要将de软件包的版本更改为:npm安装--save@ionic native/android full-screen@4