The basic set of styles are based on a typographic scale of 12, 14, 16, 20, and 34. Too many type sizes and styles at once can wreck any layout. It is generally a good practice to use the sp unit so the size can scale depending on user settings. Its value must consist of two parts: a floating-point number followed by a unit. Īndroid:textSize specifies the font size.
The possible values are: normal, bold, italic. The android:textStyle attribute can be used to put emphasis on the text. In addition to the above, there is another attribute value named "normal" which defaults to the sans typeface.
You can specify any one of them as the value for the android:typeface attribute in the XML: Text Attributes TypefaceĪs stated in the overview, there are three different default typefaces which are known as the Droid family of fonts: sans, monospace and serif. This guide will take a look at the TextView and discuss common properties associated with this view as well as how to setup custom typefaces. You might, however, see the need to use custom fonts for special purposes.
They were designed to be optimal for mobile displays, so these are the three fonts you will be working with most of the time and they can be styled using a handful of XML attributes. Every Android device comes with a collection of standard fonts: Droid Sans, Droid Sans Mono and Droid Serif.