我正在使用Appcelerator开发Android设备。由于我需要画一些线,我在我的项目中下载并安装了“com.wwl.canvas”模块。当我在我的项目上尝试app.js示例时,一切正常......无论如何,当我编写这段代码时:
var Canvas = require('com.wwl.canvas');
var canvas = Canvas.createCanvasView({
backgroundColor: "transparent",
right: "20dp",
bottom: "80dp",
top: "20dp",
left: "20dp",
zIndex: 10
});
overlay.add(canvas);
var shapes = [
{
name: 'polygon',
fn: function(){
canvas.beginPath();
canvas.lineWidth = 7;
canvas.strokeStyle = 'blue';
canvas.drawLine(0,0,400,400);
canvas.drawLine(400,400,400,300);
canvas.drawLine(400,300,800,300);
canvas.drawLine(800,300,700,200);
canvas.drawLine(700,200,0,0);
}
}
];
shapes[0].fn();
它说:“在空对象引用上尝试从字段'com.wwl.canvas.CanvasView $ CView com.wwl.canvas.CanvasView.cView'读取 在com.wwl.canvas.CanvasViewProxy.beginPath(CanvasViewProxy.java:109) ......“
任何人都可以帮助我吗?