Phonegap Cordova - 全屏后底部的黑色状态栏 [英] Phonegap Cordova - Black status bar on bottom after fullscreen
问题描述
我一直有这个问题,只要我记得。我认为它可能刚刚从我的手机或模拟,但在发布我的应用程序后,我仍然看到这个黑色矩形在屏幕的底部,它看起来像状态栏。
这发生在我在我的config.xml中。
< preference name =android-build-tool value =gradle/>
< preference name =Fullscreenvalue =true/>
< preference name =Orientationvalue =portrait/>
屏幕截图: b
$ b
UPDATE strong>
我注意到,如果我 MINIMIZE 游戏,底部的黑条消失,然后右击它。 >
我尝试创建一个新项目,一旦我在config.xml中输入了全屏首选项,就会发生同样的事情。
看起来像顶部栏转移到底部> _>
似乎问题在于定义画布的尺寸。解决这个前一段时间,所以我不知道这是否是固定的:
var c = document.getElementById( canvas1);
var ctx = c.getContext(2d);
var pixelRatio = window.devicePixelRatio || 1; //获取设备的像素比例
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';
同时尝试删除您的index.css文件
I've been having this issue for as long as I can remember. I thought it might have just been from my phone or the emulation, but after publishing my app I still see this black rectangle at the bottom of screen, which looks like the status bar.
This happens after I have this in my config.xml
<preference name="android-build-tool" value="gradle" />
<preference name="Fullscreen" value="true" />
<preference name="Orientation" value="portrait" />
Screenshot:
UPDATE
I noticed the bottom black bar goes away if I MINIMIZE the game and click it right back up (weird).
I tried creating a new project and same thing happens once I put the full screen preference in config.xml.
It seems like the top bar transfers to the bottom >_>
Seems that the problem is with defining the dimensions of the canvas. Solved this a while ago so I'm not sure if this is what fixed it:
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';
Also try deleting your index.css file
这篇关于Phonegap Cordova - 全屏后底部的黑色状态栏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!