0

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

RunRev 中是否有任何工具可以像 android 中的相对布局一样调整视图大小。

4

3 回答 3

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

让我知道这是否可以解决问题。

于 2012-02-06T13:22:55.023 回答
0

这里有几个问题需要考虑。

  1. 方向
  2. 长宽比
  3. 像素密度

A计划

要使用一张图像处理所有这三种情况,我建议使用方形图像。使其大小成为您想要支持的中等密度设备所需大小的两倍,然后将其导入 LiveCode。将 resizeQuality 设置为“好”(如果将其设置为“最佳”,它可能会有点慢),然后将其 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。然而,内存使用量要低得多,就可以使用的背景类型而言,灵活性要低得多。

于 2013-03-09T06:06:48.957 回答
0

当调整字段或按钮的大小时,不要忘记同时更改 resizeStack 处理程序中的 textSize。

缩放:

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
于 2013-03-11T13:46:52.417 回答