如何将我的图像宽度改为屏幕宽度的两倍?

我希望我的图像的高度与显示器的高度相同,宽度为两个屏幕宽度,我尝试过这种方式,但是图像的宽度没有改变。

 length = display.actualContentWidth * 2

 local image = display.newImage("icon.png",display.contentCenterX,display.contentCenterY)
       image.width = length
       image.height = display.actualContentHeight
点赞
用户2858170
用户2858170

根据手册,属性width和height给出了原始图像的尺寸。因此更改它们的值很可能不会调整图像的大小。

一旦计算出比例因素,您可以使用 scale 函数将显示对象调整为所需的尺寸。

2017-08-09 10:41:38