使用Titanium排列数据
Lining up data with Titanium
我需要在列表视图的底部显示5行摘要数据。我创建了一个页脚并尝试:
label1.text+num.toString()
footer.add(label1) // repeat for 5 labels
listview.add(footer)
五个标签是固定长度的绳子,但没有通过,仍然没有正确排列。我读过一些关于表视图的帖子,这是我需要的吗?
编辑:单空间字体工作,但仍然。。。
我认为您的第一条语句中有一个拼写错误:
label1.text+num.toString()
我认为应该是:
label1.text = num.toString();
这可以解释你没有看到任何标签。
如果不是解决方案,并且标签的text属性设置为语句之前的任何内容,请提供更多代码以帮助您。
为了解决项目正确排列的问题,我所做的是创建一个视图。然后用顶部/左侧定位向其中添加单个元素。
var summary_win2 = Titanium.UI.createView({
height: '50%',
top: 0
});
// summary_win2.add(summary_win2_label0);
// I did the above code for all the elements below
var summary_win2_label0 = Titanium.UI.createLabel({
text: "Data 1",
font:{fontSize:24,fontWeight:'normal'},
color:'#000',
top: 0,
left:3
});
var summary_win2_data0 = Titanium.UI.createLabel({
text: "0",
font:{fontSize:24,fontWeight:'normal'},
color:'#000',
top: 0,
left:120
});
var summary_win2_label1 = Titanium.UI.createLabel({
text: "Data 2",
font:{fontSize:24,fontWeight:'normal'},
color:'#000',
top: 25,
left:3
});
var summary_win2_data1 = Titanium.UI.createLabel({
text: "0",
font:{fontSize:24,fontWeight:'normal'},
color:'#000',
top: 25,
left:120
});
var summary_win2_label2 = Titanium.UI.createLabel({
text:"Data 3",
font:{fontSize:24,fontWeight:'normal'},
color:'#000',
top: 50,
left:3
});
var summary_win2_data2 = Titanium.UI.createLabel({
text: "0",
font:{fontSize:24,fontWeight:'normal'},
color:'#000',
top: 50,
left:120
});
var summary_win2_label3 = Titanium.UI.createLabel({
text: "Data 4",
font:{fontSize:24,fontWeight:'normal'},
color:'#000',
top: 75,
left:3
});
var summary_win2_data3 = Titanium.UI.createLabel({
text: "0",
font:{fontSize:24,fontWeight:'normal'},
color:'#000',
top: 75,
left:120
});
var buttonClear_win2 = Titanium.UI.createButton({
title: 'Clear',
top: 110,
width: 100,
height: 50,
left: 0
});
相关文章:
- 用程序搜索JQuery数据表中的文本
- 要求输入在数据列表中
- 正在将数据主题添加到所有项目
- 函数参数中的数据与指定变量之间的任何性能差异
- 在VanillaJS中模拟模型双向数据绑定
- CSS-如何定位内容数据标题
- 使用电话间隙在Android应用程序中显示SQL Lite的数据
- 无法在数据endVal中设置值=“”;{{ucount}}”;使用Angular JS的CountUp
- 排列具有相同数据的多个对象(减少冗余)
- 使用Titanium排列数据
- 以表格格式排列JSON数据
- 酒窝.js:不是按字母顺序排列y轴,而是按数据集中的出现顺序排列
- Ajax源数据表按数据顺序排列,并显示格式化日期
- js数据表重新排列后排序错误
- D3:使用.map()来重新排列数据数组
- 当数据不按顺序排列时,如何对数组中的json数据进行排序
- JSON数据按月排列/重新排序
- Javascript/PHP-使用PHP从服务器检索数据并使用Javascript生成/重新排列数据是个好主意吗
- 如何使用 lodash 重新排列数据格式
- 使用jquery在两个列表中传输和排列数据