Titanium Community Questions & Answer Archive

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

Bolding Within A String

So, I've been able to figure most everything out I need to, but before I resign myself to making a new label for every bolded string in a body of text, I wanted to ask. I don't think it can be done, but can it?

For example, within the body of text below, if I want to bold the '1.', '2.', etc, within this, do I have to compose a new createLabel with a bolded weight just for this? If I don't do that, and I'm using a vertical layout, in order to get the text after this bolded element to line up with it, do I have to make a single line string to finish that line of text, and then another block to do the next line and then the rest of the string?


— asked April 30th 2010 by Neal Kraus
  • bold
  • layout
  • text

1 Answer

  • Hey Neal,

    You're right as far as I know, the only way to mix bold and normal weight text like that is to either use a webview where you can do it with HTML or to use different labels depending on the font weight you need at the time.

    If I'm understanding your question about the vertical layout correctly, what I'd try is putting two labels side by side into a view and repeat that for each item in your ordered list, then add all of those views to another view thats using a vertical layout.

    — answered April 30th 2010 by Dan Giulvezan
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.