问题
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:
Install StatusBar plugin:
cordova plugin add cordova-plugin-statusbar
Update
config.xml
:<gap:plugin name="com.phonegap.plugin.statusbar" />
- 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