【发布时间】:2018-06-20 18:32:01
【问题描述】:
将 tableView 添加到其他项目(图像、字段、文本等)下方的视图中,并且表格会将其他项目推离屏幕。
在以下示例中,我将标签添加到视图,然后将表添加到视图。然后将视图添加到窗口中。表格的顶部会将标签推离屏幕顶部。如果我向下滑动,它就在那里。
还有其他人看过吗?我错过了什么吗?
Ti.UI.backgroundColor = 'white';
var win = Ti.UI.createWindow({
layout : 'vertical',
});
var tableData = [{
title : 'Apples'
}, {
title : 'Bananas'
}, {
title : 'Carrots'
}, {
title : 'Potatoes'
}, {
title : 'Apples'
}, {
title : 'Bananas'
}, {
title : 'Carrots'
}, {
title : 'Potatoes'
}, {
title : 'Apples'
}, {
title : 'Bananas'
}, {
title : 'Carrots'
}, {
title : 'Potatoes'
}, {
title : 'Apples'
}, {
title : 'Bananas'
}, {
title : 'Carrots'
}, {
title : 'Potatoes'
}];
var view = Ti.UI.createScrollView({
backgroundColor : 'transparent',
top : 0,
left : 0,
width : 'auto',
height : Titanium.UI.SIZE,
layout : 'vertical',
id : 'mainView',
});
var label1 = Ti.UI.createLabel({
color : 'white',
text : 'I am label 1',
font : {
fontSize : 50,
},
top : 0,
});
view.add(label1);
var table = Ti.UI.createTableView({
data : tableData,
top : 0
});
view.add(table);
win.add(view);
win.open();
【问题讨论】:
标签: android titanium appcelerator appcelerator-titanium