Appcelerator钛合金:如何在xml中将TableViewStyle设置为GROUPED

时间:2012-12-30 20:53:15

标签: titanium tableview appcelerator appcelerator-mobile

我尝试了各种各样的事情(也试过将样式设置为GROUPED):

<Alloy>
    <Window title="Add Remember">
        <TableView id="table" style="Ti.UI.iPhone.TableViewStyle.GROUPED">
        <!-->
            <TableViewSection headerTitle="Title">
                <TableViewRow><TextField hintText="Title" id="title"></TextField></TableViewRow>
            </TableViewSection>

            <TableViewSection headerTitle="Location">
                <TableViewRow><TextField hintText="Location" id="location"></TextField></TableViewRow>
            </TableViewSection>

            <TableViewSection headerTitle="Notes">
                <TableViewRow><TextArea hintText="Notes"></TextArea></TableViewRow>
            </TableViewSection>
        </!-->
        </TableView>
    </Window>
</Alloy>

但没有shebang。

我还注意到在控制器文件中以编程方式设置它是有效的,但前提是我还没有向TableView添加任何部分或行(这就是上面注释掉部分和行的原因)。

如何在xml中设置此属性。

2 个答案:

答案 0 :(得分:0)

好的,解决方法是在TableView的xml中设置style="1";这适用于未注释的部分和行。我通过将Ti.UI.iPhone.TableViewStyle.GROUPED记录到控制台来解决这个问题;很明显,宏在xml中不起作用。

答案 1 :(得分:0)

我是这样做的:

form.xml

<TableView class="form">
  ...
</TableView>

app.tss

".form": {
  style: Ti.UI.iPhone.TableViewStyle.GROUPED
}