我正在使用 Phonegap 使用 HTML/Canvas、Javascript 和 CSS 开发 Android 应用程序。使用下面的代码,我将 Canvas 拉伸(stretch)到全屏。
var canvas = $("#mycanvas");
var ctx = canvas.get(0).getContext("2d");
canvas.attr("width", $(window).get(0).innerWidth);
canvas.attr("height", $(window).get(0).innerHeight);
ctx.clearRect(0, 0, canvas.width, canvas.height);
我还在 AndroidManifest.xml 文件中修复了横向 View 。
android:screenOrientation="landscape"
在 config.xml 中我要求全屏显示。
<preference name="fullscreen" value="true" />
到目前为止一切顺利,但有一个大问题。我可以从屏幕上滚动我的应用程序,尽管那里没有内容。我只看到深灰色背景。
有没有人知道如何解决这个问题?我将不胜感激。
最佳答案
我建议您尝试使用视口(viewport)元标记。这将使您的 html 文档正确缩放。 https://developer.mozilla.org/en-US/docs/Mobile/Viewport_meta_tag
关于android - 在 Android 应用程序中没有滚动,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13725450/