Hide Status Bar in Android with Phonegap Build

南楼画角 提交于 2019-11-30 23:19:52

You can try setting

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

in the config.xml

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.

  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.

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.

Remzo

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.

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