问题
I'm getting black horizontal bars in my android cordova app at the top and bottom of the screen. I've tried adding the fullscreen plugin and the tag to config.xml but it won't go away:
https://i.imgur.com/l2ZIaAJ.png
config.xml:
<?xml version='1.0' encoding='utf-8'?>
<widget id="io.cordova.hellocordova" version="1.0.0" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<name>Test</name>
<description>
Test
</description>
<author email="dev@cordova.apache.org" href="http://cordova.io">
Apache Cordova Team
</author>
<content src="index.html" />
<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:*" />
<preference name="Fullscreen" value="true" />
<platform name="android">
<allow-intent href="market:*" />
</platform>
<platform name="ios">
<allow-intent href="itms:*" />
<allow-intent href="itms-apps:*" />
</platform>
<engine name="browser" spec="^5.0.0" />
<engine name="android" spec="^6.3.0" />
<plugin name="cordova-plugin-whitelist" spec="^1.3.2" />
<plugin name="cordova-plugin-file" spec="^4.3.3" />
<plugin name="cordova-plugin-filechooser" spec="git+https://github.com/ihadeed/cordova-filechooser.git" />
<plugin name="cordova-plugin-fullscreen" spec="^1.2.0" />
<plugin name="cordova-plugin-console" spec="^1.1.0" />
</widget>
js:
alert("fullscreen test");
AndroidFullScreen.setSystemUiVisibility(AndroidFullScreen.SYSTEM_UI_FLAG_FULLSCREEN | AndroidFullScreen.SYSTEM_UI_FLAG_LOW_PROFILE, function(){
alert("success fullscreen");
}, function(){
alert("error fullscreen");
});
"success fullscreen" gets alerted so I'm not sure what's wrong.
I also tried adding this to the manifest:
AndroidManifest.xml:
android:theme="@android:style/Theme.Black.NoTitleBar.Fullscreen"
No luck. Just can't get these black bars to go away.
来源:https://stackoverflow.com/questions/46675408/cordova-fullscreen-black-bars-on-android