Titanium Community Questions & Answer Archive

We felt that 6+ years of knowledge should not die so this is the Titanium Community Questions & Answer Archive

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?

— asked June 30th 2010 by Phillip Williams
  • by
  • lables
  • side
0 Comments

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);
    
    — answered June 30th 2010 by Kevin Smithson
    permalink
    0 Comments
  • 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

    — answered June 30th 2010 by Christian Sigl
    permalink
    0 Comments
The ownership of individual contributions to this community generated content is retained by the authors of their contributions.
All trademarks remain the property of the respective owner.