【问题标题】:Livecode Responsive UI Android AppLivecode 响应式 UI Android 应用程序
【发布时间】:2015-01-24 13:37:59
【问题描述】:

在我们今天的世界里,有很多不同屏幕尺寸的安卓设备。有大(平板电脑)和小(手机)之分。 如何让 livecode 应用中的 UI 具有响应性,以便我的应用适合所有屏幕尺寸?


附加: 我尝试勾选Live Resizing 复选框,但它不起作用。也许我错过了什么。

【问题讨论】:

    标签: android user-interface responsive-design livecode


    【解决方案1】:

    假设您有一张带有一个字段和一个按钮的卡片。打开堆栈时,可以将堆栈的rect设置为screenRect。这会触发 resizeStack 消息,让您重新排列卡片上的控件。

    on preOpenCard
      set the rect of this stack to the screenRect
      pass preOpenCard
    end preOpenCard
    
    on resizeStack
      lock screen
      put the rect of this cd into myRect
      subtract 64 from item 4 of myRect
      set the rect of fld 1 to myRect
      set the loc of btn 1 to the bottom of fld 1 + 32,item 2 of the loc of this cd
      set the right of btn 1 to the width of this cd - 16
      unlock screen
    end resizeStack
    

    此外,您可以将堆栈的fullScreenMode 属性设置为例如"exactFit"。您必须在preOpenStack 处理程序(或startUp 处理程序)中执行此操作。这将调整堆栈的大小,您不需要使用resizeStack 处理程序,但所有控件的屏幕纵横比与创建堆栈的设备的屏幕纵横比不同,因此所有控件看起来都略有畸形.

    【讨论】:

    • 如果卡片中有很多对象,我需要重新调整所有内容的大小,并且可以编写很多脚本。此外,很难重新调整文本的大小(字体大小)以使其适合标签的大小。我最好的方法是编写这些脚本 set the fullScreenMode of this stack to "exactFit"preOpenStack 处理程序,即使它看起来已经被拉伸,它也可以工作。我没有什么好担心的,因为没有非常短的宽度和非常长的高度或非常短的高度和非常长的宽度屏幕尺寸的 android 设备。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2014-05-31
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-08-16
    相关资源
    最近更新 更多