Appcelerator 窗口中的 ScrollView 和 TableView
我有一个窗口,我想在顶部有一个 ScrollableView ,在底部区域有一个 TableView 。怎么做呢?
我有以下代码:
var currentWin = Ti.UI.currentWindow;
var dbdata = [
{ title: '' + man.fieldByName('manufacturer') + '', header: 'Manufacturer' },
{ title: '' + rows.fieldByName('series') + '', header: 'Series' },
{ title: '' + rows.fieldByName('engine') + '', header: 'Engine' },
{ title: '' + rows.fieldByName('horsepower') + '' , header: 'Horsepower' },
{ title: '' + rows.fieldByName('yearfrom') + ' to ' + rows.fieldByName('yearto') + '' , header: 'Year' },
{ title: '' + rows.fieldByName('types') + '' , header: 'Engine Type' }
];
var tableView = Ti.UI.createTableView({
data: dbdata,
top: 156
});
var image1 = Ti.UI.createView({width:320,height:156,backgroundImage:'../images/gallery/bmw3er/image1.jpg'});
var image2 = Ti.UI.createView({width:320,height:156,backgroundImage:'../images/gallery/bmw3er/image2.jpg'});
var image3 = Ti.UI.createView({width:320,height:156,backgroundImage:'../images/gallery/bmw3er/image3.jpg'});
var image4 = Ti.UI.createView({width:320,height:156,backgroundImage:'../images/gallery/bmw3er/image4.jpg'});
var image5 = Ti.UI.createView({width:320,height:156,backgroundImage:'../images/gallery/bmw3er/image5.jpg'});
var image6 = Ti.UI.createView({width:320,height:156,backgroundImage:'../images/gallery/bmw3er/image6.jpg'});
var scrollView = Ti.UI.createScrollableView({
views:[image1,image2,image3,image4,image5,image6],
showPagingControl:true,
clipViews:false,
top:0,
left:30,
right:30,
width:320,
height:156,
opacity:0
});
currentWin.add(tableView);
currentWin.add(scrollView);
但是当我使用上面的代码时,只显示我的 tableView 。当我只使用 currentWin.add(scrollView) 并删除 currentWIn.add(tableView) 时,会显示滚动视图 - 但不会同时显示 - 为什么?!?!?
注意:我已经从代码示例中删除了数据库查询!
希望你能帮忙?
谢谢, 萨沙
i have a Window and i want to have a ScrollableView in the top and a TableView in the bottom area. How to do that?
I have the following code:
var currentWin = Ti.UI.currentWindow;
var dbdata = [
{ title: '' + man.fieldByName('manufacturer') + '', header: 'Manufacturer' },
{ title: '' + rows.fieldByName('series') + '', header: 'Series' },
{ title: '' + rows.fieldByName('engine') + '', header: 'Engine' },
{ title: '' + rows.fieldByName('horsepower') + '' , header: 'Horsepower' },
{ title: '' + rows.fieldByName('yearfrom') + ' to ' + rows.fieldByName('yearto') + '' , header: 'Year' },
{ title: '' + rows.fieldByName('types') + '' , header: 'Engine Type' }
];
var tableView = Ti.UI.createTableView({
data: dbdata,
top: 156
});
var image1 = Ti.UI.createView({width:320,height:156,backgroundImage:'../images/gallery/bmw3er/image1.jpg'});
var image2 = Ti.UI.createView({width:320,height:156,backgroundImage:'../images/gallery/bmw3er/image2.jpg'});
var image3 = Ti.UI.createView({width:320,height:156,backgroundImage:'../images/gallery/bmw3er/image3.jpg'});
var image4 = Ti.UI.createView({width:320,height:156,backgroundImage:'../images/gallery/bmw3er/image4.jpg'});
var image5 = Ti.UI.createView({width:320,height:156,backgroundImage:'../images/gallery/bmw3er/image5.jpg'});
var image6 = Ti.UI.createView({width:320,height:156,backgroundImage:'../images/gallery/bmw3er/image6.jpg'});
var scrollView = Ti.UI.createScrollableView({
views:[image1,image2,image3,image4,image5,image6],
showPagingControl:true,
clipViews:false,
top:0,
left:30,
right:30,
width:320,
height:156,
opacity:0
});
currentWin.add(tableView);
currentWin.add(scrollView);
But when i use the upper code, only my tableView is shown. When i only use currentWin.add(scrollView) and remove the currentWIn.add(tableView), the scrollView is shown - but never both - why?!?!?
Notice: i have removed the database queries from the code sample!!!
Hope you can help?
Thanks,
Sascha
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
删除
Ti.UI.createScrollableView
函数调用中的以下参数opacity: 0
。问候。
亚敦
remove the following parameter
opacity: 0
inTi.UI.createScrollableView
function call.Regards.
Adun