Phonegap Cordova - 全屏后底部的黑色状态栏

ter*_*rgh 9 javascript android config statusbar cordova

只要我记得,我一直有这个问题.我以为它可能刚刚来自我的手机或仿真,但在发布我的应用程序后,我仍然在屏幕底部看到这个黑色矩形,看起来像状态栏.

这在我的config.xml中有这个后发生

<preference name="android-build-tool"      value="gradle"   />   
<preference name="Fullscreen"              value="true"     />
<preference name="Orientation"             value="portrait" />
Run Code Online (Sandbox Code Playgroud)

截图:

在此输入图像描述

UPDATE

我注意到如果我最小化游戏然后再点击它(奇怪),底部的黑色条会消失.

我尝试创建一个新项目,一旦我将全屏首选项放在config.xml中,就会发生同样的事情.

看起来顶部栏转移到底部> _>

ter*_*rgh 1

似乎问题在于定义画布的尺寸。不久前解决了这个问题,所以我不确定这是否解决了这个问题:

var c  = document.getElementById("canvas1");
var ctx  = c.getContext("2d");
var pixelRatio = window.devicePixelRatio || 1; // get pixel ratio of device
c.width = window.screen.width * pixelRatio;
c.height = window.screen.height * pixelRatio;
c.style.width = window.screen.width + 'px';
c.style.height = window.screen.height + 'px';
Run Code Online (Sandbox Code Playgroud)

另请尝试删除您的index.css文件