Is it possible to have two labels next to each other?
I am trying to create a label in a tablerow. The first part will be in bold with a large font. There needs to be another label next to it that is normal and smaller. Is is possible to create this without knowing the far right position of the first label?
2 Answers
-
Accepted Answer
It is easiest if you know the length of the first label but if you dont because it is dynamic than you can try setting the custom view inside the row to
rowView.layout = 'horizontal'
and add that to a row. I havent tried it myself in a table but here is an example:var win = Ti.UI.currentWindow; var view = Ti.UI.createView({ height:300, width:320, layout:'horizontal' }); win.add(view); var l1 = Ti.UI.createLabel({ text:'I am the first label', left:5, width:'auto', height:20, }); view.add(l1); var l2 = Ti.UI.createLabel({ text:'I am the second label', left:2, width:'auto', height:20 }); view.add(l2); var l3 = Ti.UI.createLabel({ text:'I am the third label', left:2, width:'auto', height:20 }); view.add(l3);
-
there is a layout: 'vertical' property for vertical alignment of elements, however i don't think that this is implemented for horizontal alignment too at the moment