android - 在 Android 应用程序中没有滚动

标签 android cordova html5-canvas

我正在使用 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/

相关文章:

javascript - 如何正确添加到使用 requestAnimationFrame 不断更新的变量

android - 在 Phonegap 中读取 URL/Google Docs/XML

javascript - Canvas 动画 - 卡住

html5-canvas - Canvas 上的 drawImage() 使颜色饱和并弄乱 alpha

java - Dagger 2 : error while getting a multiple instances of same object with @Named

android - phonegap html5 android 同步文件系统 IO

Cordova NFC 插件不工作

android - 解决 Logcat 警告消息

android - PhoneGap - 防止屏幕方向改变

android - 用 FragmentActivity 和 Fragments 替换 TabActivity