Styled Text

If you want really rich text, you should have raw resources containing HTML, then pour those into a WebKit widget. However, for light HTML formatting, using <b>, <i>, and <u>, you can just use a string resource:


<string name="b">This has <b>bold</b> in it.</string> <string name="i">Whereas this has <i>italics</i>!</string> </resources>

You can access these the same as with plain strings, with the exception that the result of the getString() call is really an object supporting the android.text.Spanned interface:

((TextView)findViewById(R.layout.another label)) .setText(getString(R.string.laughs));

0 0

Post a comment