Hide Status Bar in Android with Phonegap Build

Deadly 提交于 2020-01-11 03:48:13

问题


I have enabled fullscreen in the config.xml file but when the keyboard appears ,status bar is shown also and stays there unless i tap on it.There is a way to avoid this in Ios but i haven't find anything for android.At least can i tap the status bar programmaticaly with jquery?


回答1:


You can try setting

<preference name="Fullscreen" value="true" /> 

in the config.xml




回答2:


I had this same issue and what fixed this for me was adding this line to the config.xml file:

<preference name="StatusBarOverlaysWebView" value="true" />

Then updating my code on PGB.




回答3:


  1. Install StatusBar plugin: cordova plugin add cordova-plugin-statusbar

  2. Update config.xml: <gap:plugin name="com.phonegap.plugin.statusbar" />

  3. Hide bar on startup or when you need it. StatusBar.hide();

See https://github.com/phonegap-build/StatusBarPlugin plugin for more information.




回答4:


I tried removing:

<preference name="StatusBarBackgroundColor" value="#ee6e73" />

from config.xml - no joy. Tried adding:

<preference name="Fullscreen" value="true" />

to config.xml - also no joy. Inverting:

<preference name="StatusBarOverlaysWebView" value="false" />

to

<preference name="StatusBarOverlaysWebView" value="true" />

provided no solution. In all cases, the status bar shows with the keyboard, but doesn't ever go away. Ended up solving it with JavaScript:

$("body").on("blur.app", "input", StatusBar.hide);

The status bar still shows with the keyboard, but is dismissed with the blur event.




回答5:


For me it worked to install the latest version, see this updated answer:

Actually, there is a fix for cordova-plugin-statusbar that has been committed on github and should land in version 2.1.4+ 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.



来源:https://stackoverflow.com/questions/35826580/hide-status-bar-in-android-with-phonegap-build

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!