我想以编程方式创建一个图像对象,并将图像拉伸到视图的大小,而不是图像大小。这是我的代码。缺少什么?
var createButton = new SMF.UI.Image();
createButton.image = "answer.png";
createButton.top = 5;
createButton.width = 38;
createButton.height = 38;
createButton.left = 5;
createButton.onShow = function(e) {
alert("object created");
};
答案 0 :(得分:1)
您可以使用以下代码行创建strecth类型的图像;
var createButton = new SMF.UI.Image();
createButton.image = "answer.png";
createButton.top = 5;
createButton.width = 38;
createButton.height = 38;
createButton.left = 5;
createButton.imageFillType = SMF.UI.ImageFillType.stretch;
createButton.onShow = function(e) {
alert("object created");
};
您可以查看更多信息:http://docs.smartface.io/?topic=html/M_SMF_UI_Image__ctor.htm
Smartface.io团队