【问题标题】:How to insert headerTitle in mu TableView如何在我的 TableView 中插入标题标题
【发布时间】:2016-06-15 10:26:30
【问题描述】:

我正在 appcelerator studio 中构建一个简单的应用程序。 所以我想在我的视图中显示一个 TableView。

这是 socialHistory.xml

<Alloy>
    <View class="container">
        <TableView id="table">
            <TableViewSection id="table" >
                <TableViewRow title="Apple"/>
                <TableViewRow title="Bananas"/>
            </TableViewSection>
        </TableView>
    </View>
</Alloy>

这是 socialHistory.js

var args = $.args;
//header table
var tableData = [ 
    {title: "Pippo"}, 
    {title: "Pluto"}, 
    {title: "Paperino"}, 
    {title: "Balto"} 
];

$.table.headerTitle=tableData;

但如果我尝试执行我的代码,我无法看到我的表格的标题

【问题讨论】:

    标签: tableview appcelerator appcelerator-alloy


    【解决方案1】:

    这不是设置 headerTitle 的方法,因为 headerTitle 只接受 String,因为它只是一个纯文本。见headerTitle

    您在代码中所做的将设置 tableview 行而不是标题,并且看起来您已经为 table 及其 tableviewsection 设置了 id='table'。

    您似乎是作为初学者学习 Titanium :),所以我建议您先阅读文档,然后尝试合金指南中的示例。它将帮助您以有效的方式学习。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-12-13
      • 1970-01-01
      • 1970-01-01
      • 2015-11-29
      相关资源
      最近更新 更多