可以在 XDK 中模拟这个简单的事情,从 XDK 存根开始,然后插入一个主体。
<!DOCTYPE html><!--HTML5 doctype-->
<html>
<head>
<title>Your New Application</title>
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=0" />
<style type="text/css">
/* Prevent copy paste for all elements except text fields */
* { -webkit-user-select:none; -webkit-tap-highlight-color:rgba(255, 255, 255, 0); }
input, textarea { -webkit-user-select:text; }
body { background-color:white; color:black }
</style>
<script src='intelxdk.js'></script>
<script type="text/javascript">
/* This code is used to run as soon as Intel activates */
var onDeviceReady=function(){
//hide splash screen
intel.xdk.device.hideSplashScreen();
};
document.addEventListener("intel.xdk.device.ready",onDeviceReady,false);
</script>
</head>
<body>
<canvas id="game" width=300 height=300></canvas>
<script type="text/javascript"> (function() {
var ctx, noise;
ctx = document.getElementById("game").getContext("2d");
ctx.fillStyle = "#000";
ctx.fillRect(0, 0, 300, 300);
noise = function() {
var color, x, y, _i, _results;
_results = [];
for (x = _i = 0; _i <= 20; x = ++_i) {
_results.push((function() {
var _j, _results1;
_results1 = [];
for (y = _j = 0; _j <= 20; y = ++_j) {
color = Math.floor(Math.random() * 360);
ctx.fillStyle = "hsl(" + color + ", 60%, 50%)";
_results1.push(ctx.fillRect(x * 15, y * 15, 14, 14));
}
return _results1;
})());
}
return _results;
};
alert(ctx.canvas.width.toString());
setInterval(noise, 100);
}).call(this);
</script>
</body>
</html
---构建也可以正常工作,但是将 .apk 部署到 Android-11 设备时,它只是空白。
另外:部署 XDK 示例项目工作正常