What is the default text size on Android?

Rene picture Rene · Apr 10, 2011 · Viewed 129.6k times · Source

I have a mixture of Buttons and an own View, where I set my text size using Paint.setTextSize(). I want the text size to look the same like the text on the Button. Now, I can of course set the text size of the button to e.g. 18sp, and use 18 in my view. But for a better integration, I simply would like to know, what text size is "normal" for buttons. From my test, it should be something like 12sp, but I have not found any documentation on this.

Leaving the default sizes leaves way too small text on the view.

Maybe I should use still another approach to this issue?

Answer

Tobrun picture Tobrun · Mar 14, 2014

In general:

Three "default" textSize values:

 - 14sp
 - 18sp
 - 22sp

These values are defined within the following TextAppearances:

 - TextAppearance.Small
 - TextAppearance.Medium
 - TextAppearance.Large

More information about Typography can be found in the design guidelines

Related to your question:

If you don't set a custom textSize or textAppearance, TextAppearance.Small will be used.


Update: Material design:

New guidelines related to font and typefaces. The standard rule of 14sp remains (body).

Examples how to set textappearances

AppCompat version:

android:textAppearance="@style/TextAppearance.AppCompat.Body"

Lollipop and up version:

android:textAppearance="@android:style/TextAppearance.Material.Body"