I'm trying to create a TableView containing a TableViewSection (which includes a header image) and several rows (which each inlude a label, some images and a button).
In the iPhone-Simulator, it all works well, but on the Android-Emulator, it only displays the row label. Even the hasDetail-Argument is ignored. Any idea what I'm doing wrong here? Below a simplified versionof my code.
var win = Ti.UI.currentWindow;
var tableView = Titanium.UI.createTableView({
scrollable:true
});
var item_list = Array('foo', 'bar');
var logo = Titanium.UI.createImageView({
width:193,
height:44,
visible:true,
backgroundImage:'../images/logo.png',
});
var headerView = Titanium.UI.createView({
height:50,
backgroundColor:'#960017'
});
var listSection = Titanium.UI.createTableViewSection({
headerView:headerView,
height:165,
});
for (i=0; i < item_list.length; i++) {
var row = Titanium.UI.createTableViewRow({
color:'#ffffff',
hasDetail: true
});
row_title = Titanium.UI.createLabel({
text: 'Foo',
left: 4,
color: '#ffffff',
width: 200
});
row_button = Titanium.UI.createButton({
title: 'Button text',
width: 100,
height: 24,
right: 2,
});
var row_images = Titanium.UI.createImageView({
width: 60,
height: 12,
image: '../images/image.png'
});
row.add(row_title, row_images, row_button);
listSection.add(row);
}
headerView.add(logo);
tableView.setData([listSection]);
win.add(tableView);
Instead of using
headerView:headerView
try the following
var headerView = Titanium.UI.createView({
height:50,
backgroundColor:'#960017'
});
tableView.headerView = headerView;