当我安装全屏插件后,并在config.xml 添加全屏后android是全屏的效果。但是在键盘输入后头部状态栏和底部状态栏重新显示。解决方法如下:
1.安装插件
ionic cordova plugin add cordova-plugin-fullscreen
npm install --save @ionic-native/android-full-screen
2.在app.component.ts里进行操作
import { AndroidFullScreen }from '@ionic-native/android-full-screen';
constructor(private androidFullScreen: AndroidFullScreen){
}
if((this.device.platform).toLowerCase() ==='ios'){
}else{
//监听键盘关闭时间,后全屏(不显示状态栏和虚拟按键)
window.addEventListener('native.keyboardhide', function(e){
this.androidFullScreen.isImmersiveModeSupported()
.then(() =>this.androidFullScreen.immersiveMode())
.catch((error:any) => console.log(error));
});
}