Книга: Beginning Android

Styled Text

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:

<resources>
 <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));

Оглавление книги

Оглавление статьи/книги

Генерация: 6.158. Запросов К БД/Cache: 3 / 0
поделиться
Вверх Вниз