LiveCode / RunRev如何根据显示大小调整堆栈大小

时间:2011-12-09 09:14:55

标签: mobile new-operator livecode

我是新的livecode app开发人员,正在开发一个需要多分辨率的移动应用程序 根据显示尺寸拟合。但是当我使用图像背景时,如果显示超出图像大小,则会显示空白区域

是否有任何工具在RunRev中调整视图大小作为android中的相对布局。

3 个答案:

答案 0 :(得分:0)

要将图像对象的矩形设置为窗口的矩形,可以使用

set the rect of img "Your Image" to the rect of this cd

我不确定这是否足够。对于多种分辨率,通常我会制作多个堆栈。你或许可以这样做:

set the rect of this stack to the screenRect
set the rect of img "Your Image" to the rect of this cd

如果这可以解决问题,请告诉我。

答案 1 :(得分:0)

这里有一些问题需要考虑。

  1. 取向
  2. 方面比例
  3. 像素密度
  4. 计划A

    要用一张图像处理所有这三种情况,我建议使用方形图像。使其大小为您想要支持的中等密度设备所需的两倍,然后将其导入LiveCode。将resizeQuality设置为“good”(如果将其设置为“best”,它可能会有点慢)然后将lockLoc设置为true。现在将宽度和高度除以2,这样您最终得到的图像显示为其大小的一半。这将在高分辨率显示器上保持合理的质量。请记住,要保持图像的重要位置,因为顶部和侧面将根据方向和纵横比被切断。

    下一步是resizeStack脚本,以确保按比例调整图像大小(此脚本假定图像为方形):

    on resizeStack
     lock screen
     if the height of this card > the width of this card then
        set the width of image "background" to the height of this card
        set the height of image "background" to the height of this card
     else
        set the width of image "background" to the width of this card
        set the height of image "background" to the width of this card
     end if
     set the loc of image "background" to the loc of this card
    end resizeStack
    

    计划B

    使用重复模式并设置堆栈的backPattern。然而,使用背景类型的内存要少得多,在可以使用的背景类型方面要灵活得多。

答案 2 :(得分:0)

调整字段或按钮大小时,不要忘记同时更改调整大小堆栈处理程序中的文本大小。

缩放:

put "1.25" into pScaleFactor
set the textSize of field "your field" to round(the textSize of field "your field" * pScaleFactor)
set the textHeight of field "your field" to round(the textHeight of field "your field" * pScaleFactor)

精确:

if the height of this card > 640 then
set the textSize of field "your field" to "24"
set the textHeight of field "your field" to "26"
end if