How to change the font in a
TextView, as default it's shown up as Arial? How to change it to
First, the default is not Arial. The default is Droid Sans.
Second, to change to a different built-in font, use
android:typeface in layout XML or
setTypeface() in Java.
Third, there is no Helvetica font in Android. The built-in choices are Droid Sans (
sans), Droid Sans Mono (
monospace), and Droid Serif (
serif). While you can bundle your own fonts with your application and use them via
setTypeface(), bear in mind that font files are big and, in some cases, require licensing agreements (e.g., Helvetica, a Linotype font).
The Android design language relies on traditional typographic tools such as scale, space, rhythm, and alignment with an underlying grid. Successful deployment of these tools is essential to help users quickly understand a screen of information. To support such use of typography, Ice Cream Sandwich introduced a new type family named Roboto, created specifically for the requirements of UI and high-resolution screens.
The current TextView framework offers Roboto in thin, light, regular and bold weights, along with an italic style for each weight. The framework also offers the Roboto Condensed variant in regular and bold weights, along with an italic style for each weight.
After ICS, android includes Roboto fonts style, Read more Roboto
With the advent of Support Library 26, Android now supports custom fonts by default. You can insert new fonts in res/fonts which can be set to TextViews individually either in XML or programmatically. The default font for the whole application can also be changed by defining it styles.xml The android developer documentation has a clear guide on this here
First download the
.ttf file of the font you need (
arial.ttf). Place it in the
assets folder. (Inside assets folder create new folder named fonts and place it inside it.) Use the following code to apply the font to your
Typeface type = Typeface.createFromAsset(getAssets(),"fonts/arial.ttf"); textView.setTypeface(type);