【发布时间】:2013-12-29 15:53:04
【问题描述】:
我正在尝试在 Alloy 中实现一个简单的应用程序,该应用程序具有非常基本的结构,但我无法可靠地对其进行布局。我正在尝试将一组导航按钮与它们上方的工作区域对齐,在下面的示例中将是一个 TableView。
<Alloy>
<Collection src="book">
<Window height="100%" id="main" title="My Library {opts.username}" exitOnClose="true" onOpen="loadExtras">
<TableView id="content" dataCollection="book" top="10px" bottom="100px" onDragEnd="refreshTable">
<TableViewRow title="{title}" color="black" onClick="showBook"/>
</TableView>
<View bottom="0px" height="72px" layout="horizontal" id="actionPanel">
<Button class="footerBtn" onClick="refreshTable">View</Button>
<Button class="footerBtn" onClick="refreshTable">Help</Button>
<Button class="footerBtn" onClick="refreshTable">List</Button>
<Button class="footerBtn add" onClick="addBook"></Button>
</View>
</Window>
我可以让它工作的唯一方法是为 TableView 指定一个高度,例如 height="80%" 然后使用这个值直到我喜欢的东西布局,但我不想像我那样做需要它独立于设备的物理屏幕尺寸工作。
我如何在 Alloy 中实现这种布局,以便将视图固定到屏幕底部,并在其上方有一个可变工作区域 - 或者,我是否必须假设一个标准高度并相对于该高度工作?
【问题讨论】: