Hello,
Is it normal behaviour that when I use layout:'horizontal' every child is positioned at the vertical top of the container? It's very annoying :)
2 Answers
Sorry, see below :)
var b = Ti.UI.createView({ width:Ti.UI.SIZE, height:30, layout:"horizontal" }); var icon = Ti.UI.createImageView({ left:0, image:$icon, width:Ti.UI.SIZE, height:Ti.UI.SIZE }); var label = Ti.UI.createLabel({ font: { fontFamily:Izc.config.body_fontFamily, fontSize:10 }, height:Ti.UI.SIZE, left:5, text:"Blablabla" }); // adds b.add(icon); b.add(label);I would expect the elements to be vertically centered, but they are aligned to the top, as if the 'top' was set to 0. (tested on iOS (SDK 5.1) & Ti SDK 2.0.1.GA2)
Try this you find this as horizontal. both.
(put this code in your app.js for testing and take image as small as possible)
Remember one thing when your image size is bigger then control will take whole space for horizontal when you are giving Ti.UI.SIZE to any control. so you can not view it as horizontal layout.
var w = Ti.UI.createWindow({ title : "test", backgroundColor : 'white' }); w.open(); var b = Ti.UI.createView({ width : Ti.UI.SIZE, height : 100, layout : "horizontal" }); var icon = Ti.UI.createImageView({ left : 0, image : 'KS_nav_ui.png', width : Ti.UI.FILL, height : Ti.UI.FILL }); var label = Ti.UI.createLabel({ font : { fontSize : 10 }, height : Ti.UI.FILL, left : 15, text : "Blablabla" }); b.add(icon); b.add(label); w.add(b);
Your Answer
Think you can help? Login to answer this question!