状态栏隐藏Cordova [英] Status Bar Hide Cordova
问题描述
如果我删除状态栏,每次打开键盘(
或通知到达)都会出现错误。
If I remove the status bar, every time I open the keyboard ( or a notification arrives) there is a bug.
App.run(function($ionicPlatform) {
$ionicPlatform.ready(function() {
if(window.StatusBar) {
StatusBar.hide();
}
});
});
有什么建议吗?谢谢!
推荐答案
更新:
实际上,有一个修复 cordova-plugin-statusbar 已经在github上提交,应该在版本 2.1.4 + (即你不需要)一个额外的插件,如我原来的答案所述)。要立即获取最新的 cordova-plugin-statusbar ,请键入
Actually, there is a fix for cordova-plugin-statusbar that has been committed on github and should land in version 2.1.4+ (i.e. you don't need an additional plugin like my original answer stated). To get the latest cordova-plugin-statusbar now, type
cordova plugin add https://github.com/apache/cordova-plugin-statusbar.git
状态栏现在应该在交互时保持隐藏状态带输入,键盘等。
The statusbar should now stay hidden when interacting with inputs, keyboard etc.
原始答案:
我修复了它该插件 cordova-plugin-fullscreen
cordova plugin add cordova-plugin-fullscreen
然后,<$ c后$ c> deviceready :
StatusBar.hide();
if (typeof AndroidFullScreen !== 'undefined') { // Fullscreen plugin exists ?
function errorFunction(error) { console.error(error); }
AndroidFullScreen.isSupported(AndroidFullScreen.immersiveMode, errorFunction);
}
ImmersiveMode在与输入,键盘等交互时保持隐藏状态。
ImmersiveMode keeps it hidden while interacting with inputs, keyboard etc.
注意:根据 cordova-plugin-fullscreen 文档,这个方法仅在 Android 4.4 + 上受支持。对于Android 4.0+,还有一种精简模式,但这会在交互时显示状态栏(不理想)
Note: as per the cordova-plugin-fullscreen docs, this method is only supported on Android 4.4+. There is also a 'lean mode' for Android 4.0+, but this shows the status bar while interacting (not ideal)
这篇关于状态栏隐藏Cordova的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!