Issues with vertical-layout and width/height
Hello everyone,
i have some problems width the width- / height-attributes on a layout: 'vertical' window on iphone. I'm using Titanium SDK 1.4.1.1.
if i use the following code:
var win = Titanium.UI.createWindow({
backgroundColor:'yellow',
layout: 'vertical'
});
var tableData = [
{title: "Test1"},
{title: "Test2"},
{title: "Test3"}
];
var table = Titanium.UI.createTableView({
data: tableData,
backgroundColor: 'blue',
width: 200,
height: "100%"
});
win.add(table);
win.open();
the TableView doesn't appear in the window, an height: 'auto' property does also not work.
if i remove the vertical-layout property from the window and add an height: "100%" property to the TableView, it will work:
var win = Titanium.UI.createWindow({
backgroundColor:'yellow'
});
var tableData = [
{title: "Test1"},
{title: "Test2"},
{title: "Test3"}
];
var table = Titanium.UI.createTableView({
data: tableData,
backgroundColor: 'blue',
width: 200,
height: "100%"
});
win.add(table);
win.open();
but a height: "auto" property does not work. if i remove the complete height-attribute from the TableView, the TableView will be shown in the window, like a "100%"-height value.
has anyone suggestions what i'm doing wrong?
regards,
robert
3 Answers
-
The following solved this issue for me:
http://developer.appcelerator.com/question/3941/tableview-layout-is-improper-when-it-has-a-sibling -
Vertical layouts don't seem to accept 'auto' values in my experience. Especially if you've set the other value to an integer.
I would consider why you think you need the height value at all…
-
Try this:
var table = Titanium.UI.createTableView({ data: tableData, backgroundColor: 'blue', width: 200, top:0, bottom:0 });