簡體   English   中英

使用Phonegap在Android中隱藏狀態欄

[英]Hide Status Bar in Android with Phonegap

我想在Android上隱藏狀態欄。

在啟動時,我沒有狀態欄,但是灰色欄的頂部是狀態欄的大小。 當我使用鍵盤時,狀態欄出現。

我已經檢查了這些答案,但是並沒有解決我的問題: 使用Phonegap Build在Android中隱藏狀態欄

這是我的config.xml

<?xml version='1.0' encoding='utf-8'?>
<widget id="com.phonegap.helloworld" version="1.0.0" xmlns="http://www.w3.org/ns/widgets" xmlns:gap="http://phonegap.com/ns/1.0">
    <name>Hello world</name>
    <description></description>
    <author email="" href="http://phonegap.com"></author>
    <content src="index.html" />
    <preference name="DisallowOverscroll" value="true" />
    <preference name="android-minSdkVersion" value="14" />
    <preference name="orientation" value="landscape" />
    <preference name="Fullscreen" value="true" />

    <plugin name="cordova-plugin-whitelist" source="npm" spec="~1.3.3" />
    <plugin name="cordova-plugin-device" source="npm" spec="~1.1.6" />
    <plugin name="cordova-plugin-fullscreen" spec="~1.1.0" />
    <plugin name="cordova-plugin-statusbar" spec="~2.4.2" />

    <config-file parent="UIStatusBarHidden">
        <true/>
    </config-file>
    <config-file parent="UIViewControllerBasedStatusBarAppearance">
        <false/>
    </config-file>

    <access origin="*" />
    <allow-intent href="http://*/*" />
    <allow-intent href="https://*/*" />
    <allow-intent href="tel:*" />
    <allow-intent href="sms:*" />
    <allow-intent href="mailto:*" />
    <allow-intent href="geo:*" />

    <platform name="android">
        <allow-intent href="market:*" />
    </platform>
    <platform name="ios">
        <allow-intent href="itms:*" />
        <allow-intent href="itms-apps:*" />
    </platform>
    <engine name="android" spec="~6.3.0" />
</widget>

我也將此代碼放在JS

document.addEventListener("deviceready", onDeviceReady, false);
function onDeviceReady() {
    StatusBar.hide();
    if (typeof AndroidFullScreen !== 'undefined') {   // Fullscreen plugin exists ?
        function errorFunction(error) { console.error(error); }
        AndroidFullScreen.isSupported(AndroidFullScreen.immersiveMode, errorFunction);
    }
}

為了解決此問題,我在config.xml中添加了此首選項:

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

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM