If you ever wondered if you can style your text with HTML tags – you absolutely can. For most cases it is enough to use Html.fromHtml or you can use it directly in your string resources. Here are the most used tags:
- Bold:
<b>
,<em>
- Italic:
<i>
,<cite>
,<dfn>
- 25% increase in text size
<big>
- 20% decrease in text size
<small>
- Setting font properties:
<font face=”font_family“ color=”hex_color”>
. Examples of the possible font families includemonospace
,serif
andsans_serif
. - Setting a monospace font family:
<tt>
- Strikethrough:
<s>
,<strike>
,<del>
- Underline:
<u>
Superscript:<sup>
- Subscript:
<sub>
- Bullet points:
<ul>
,<li>
- Line breaks:
<br>
- Division:
<div>
- CSS style:
<span style=”color|background_color|text-decoration”>
- Paragraphs:
<p dir=”rtl | ltr” style=”…”>
examples taken from this great article: https://medium.com/androiddevelopers/styling-internationalized-text-in-android-f99759fb7b8f