Android Font Type Download

/ Comments off
Android Font Type Download 3,7/5 5198 reviews
Active2 months ago

Modify version of this Steiner Font dafont.com.

  1. Android 7 font has regular font style and belong to sci fi font category. This font available for Windows, Linux and MacOS. Android 7 font already viewed 766 and downloaded 37 times. Also you can download related fonts for free: Avenir LT Std 45 Book, Avenir 45 Book, Avenir LT 45 Book, Awesome, A Futura Round Bold, A Futura Round Demi and other.
  2. Like computers, smartphones are also enriched with many font typefaces. Though smartphone manufacturers fabricate a handful of well-known font types, you might, at some point in time, want to get new Android font styles that aren’t readily preinstalled. This comprehensive guide will teach you exactly how to install custom fonts on Android.

So I'd like to change the android:fontFamily in Android but I don't see any pre-defined fonts in Android. How do I select one of the pre-defined ones? I don't really need to define my own TypeFace but all I need is something different from what it shows right now.

It seems what I did up there won't really work! BTW android:fontFamily='Arial' was a stupid attempt!

TarikTarik
38.2k70 gold badges210 silver badges311 bronze badges

29 Answers

From android 4.1 / 4.2 / 5.0, the following Roboto font families are available:

in combination with

this 16 variants are possible:

  • Roboto regular
  • Roboto italic
  • Roboto bold
  • Roboto bold italic
  • Roboto-Light
  • Roboto-Light italic
  • Roboto-Thin
  • Roboto-Thin italic
  • Roboto-Condensed
  • Roboto-Condensed italic
  • Roboto-Condensed bold
  • Roboto-Condensed bold italic
  • Roboto-Black
  • Roboto-Black italic
  • Roboto-Medium
  • Roboto-Medium italic
Android

fonts.xml

Jakob ErikssonJakob Eriksson
16.7k1 gold badge17 silver badges28 bronze badges

This is the way to set the font programmatically:

put the font file in your assets folder. In my case I created a subdirectory called fonts.

EDIT: If you wonder where is your assets folder see this question

Community
Stefan BeikeStefan Beike
10.2k7 gold badges42 silver badges58 bronze badges

Starting from Android-Studio 3.0 its very easy to change font family

Using support library 26, it will work on devices running Android API version 16 and higher

Create a folder font under res directory .Download the font which ever you want and paste it inside font folder. The structure should be some thing like below

Note: As of Android Support Library 26.0, you must declare both sets of attributes ( android: and app: ) to ensure your fonts load on devices running Api 26 or lower.

Now you can change font in layout using

To change Programatically

To change font using styles.xml create a style

and apply this style to TextView

you can also Create your own font family

- Right-click the font folder and go to New > Font resource file. The New Resource File window appears.

- Enter the file name, and then click OK. The new font resource XML opens in the editor.

Write your own font family here , for example

this is simply a mapping of a specific fontStyle and fontWeight to the font resource which will be used to render that specific variant. Valid values for fontStyle are normal or italic; and fontWeight conforms to the CSS font-weight specification

1. To change fontfamily in layout you can write

2. To Change Programmatically

To change font of entire App Add these two lines in AppTheme

See the Documentation , Android Custom Fonts Tutorial For more info

Manohar ReddyManohar Reddy

Android Font Type Download

8,7734 gold badges47 silver badges73 bronze badges

I had to parse /system/etc/fonts.xml in a recent project. Here are the current font families as of Lollipop:

Here is the parser (based off FontListParser):

Feel free to use the above class in your project. For example, you could give your users a selection of font families and set the typeface based on their preference.

A small incomplete example:

Jared RummlerJared Rummler
31.1k13 gold badges100 silver badges127 bronze badges

Android doesn't allow you to set custom fonts from the XML layout. Instead, you must bundle the specific font file in your app's assets folder, and set it programmatically. Something like:

Note that you can only run this code after setContentView() has been called. Also, only some fonts are supported by Android, and should be in a .ttf (TrueType) or .otf (OpenType) format. Even then, some fonts may not work.

This is a font that definitely works on Android, and you can use this to confirm that your code is working in case your font file isn't supported by Android.

Android O Update: This is now possible with XML in Android O, based on Roger's comment.

Raghav SoodRaghav Sood
73.7k19 gold badges168 silver badges177 bronze badges
Oded BreinerOded Breiner
20.6k8 gold badges83 silver badges60 bronze badges

It's the same as android:typeface.

built-in fonts are:

  • normal
  • sans
  • serif
  • monospace

See android:typeface.

biegleuxbiegleux
12.3k11 gold badges40 silver badges50 bronze badges

If you want it programatically, you could use

Where SANS_SERIF you can use:

  • DEFAULT
  • DEFAULT_BOLD
  • MONOSPACE
  • SANS_SERIF
  • SERIF

And where ITALIC you can use:

  • BOLD
  • BOLD_ITALIC
  • ITALIC
  • NORMAL

All is stated on Android Developers

Android font type download for windows 10Joaquin IurchukJoaquin Iurchuk
4,2741 gold badge34 silver badges58 bronze badges

I am using excellent library Calligraphy by Chris Jenx designed to allow you to use custom fonts in your android application. Give it a try!

gauravdottgauravdott
3351 gold badge4 silver badges13 bronze badges

What you want is not possible. You must need to set TypeFace in your Code.

In XML what you can do is

other then this you can not play much with the Fonts in XML. :)

For Arial you need to set type face in your code.

Mohsin NaeemMohsin Naeem
11.5k3 gold badges32 silver badges48 bronze badges

An easy way to manage the fonts would be to declare them via resources, as such:

This is based on the source code here and here

android developerandroid developer
54.4k107 gold badges496 silver badges935 bronze badges

Dynamically you can set the fontfamily similar to android:fontFamily in xml by using this,

These are the list of default font family used, use any of this by replacing the double quotation string 'sans-serif-medium'

'mycustomfont.ttf' is the ttf file. Path will be in src/assets/fonts/mycustomfont.ttf , you can refer more about default font in this Default font family

anand krishanand krish

With some trial and error I learned the following.

Within the *.xml you can combine the stock fonts with the following functions, not only with typeface:

With this two styles, there was no need to use typeface in any other case. The range of combinations is much more bigger with fontfamily&textStyle.

user3508321

The valid value of android:fontFamily is defined in /system/etc/system_fonts.xml(4.x) or /system/etc/fonts.xml(5.x). But Device Manufacturer might modify it, so the actual font used by setting fontFamily value depends on the above-mentioned file of the specified device.

In AOSP, the Arial font is valid but must be defined using 'arial' not 'Arial', for example android:fontFamily='arial'. Have a qucik look at Kitkat's system_fonts.xml

//////////////////////////////////////////////////////////////////////////

There are three relevant xml-attributes for defining a 'font' in layout--android:fontFamily, android:typeface and android:textStyle. The combination of 'fontFamily' and 'textStyle' or 'typeface' and 'textStyle' can be used to change the appearance of font in text, so does used alone. Code snippet in TextView.java like this:

From the code We can see:

  1. if 'fontFamily' is set, then the 'typeface' will be ignored.
  2. 'typeface' has standard and limited valid values. In fact, the values are 'normal' 'sans' 'serif' and 'monospace', they can be found in system_fonts.xml(4.x) or fonts.xml(5.x). Actually both 'normal' and 'sans' are the default font of system.
  3. 'fontFamily' can be used to set all fonts of build-in fonts, while 'typeface' only provide the typical fonts of 'sans-serif' 'serif' and 'monospace'(the three main category of font type in the world).
  4. When only set 'textStyle', We actually set the default font and the specified style. The effective value are 'normal' 'bold' 'italic' and 'bold italic'.
Terry LiuTerry Liu
mohamad sheikhimohamad sheikhi
Yang PeiyongYang Peiyong
8,7312 gold badges16 silver badges14 bronze badges

If you want to use a TextView in so many places with same font family, extend the TextView class and set your font like this:-

Font Type

And then use this custom class in xml for the TextView like this:-

Shubham RaitkaShubham Raitka

set easily font to any textview from res>font directory programmatically

MakvinMakvin

Here is an easier way that can work in some cases. The principle is to add a not visible TextVview in your xml layout and to get its typeFace in the java code.

The layout in the xml file:

And the java code:

It has worked for me (within a TextSwitcher for example).

FrédéricFrédéric

I just want to mention that the hell with the fonts inside Android is about to end, because this year on Google IO we finally got this ->https://developer.android.com/preview/features/working-with-fonts.html

Now there is a new resource type a font and you can place all your application fonts inside res/fonts folder and access then with R.font.my_custom_font, just like you can access string res values, drawable res values etc. You have even chance to create font-face xml file, which is gonna be set of your custom fonts (about italic, bold and underline attr).

Read the link above for more info. Let's see the support.

SniperSniper
3,0001 gold badge20 silver badges24 bronze badges

You set style in res/layout/value/style.xml like that:

and to use this style in main.xml file use:

Ziem
4,1607 gold badges43 silver badges76 bronze badges
rajenderrajender
Shivam YadavShivam Yadav

Here you can see all the avaliable fontFamily values and it's corresponding font file's names(This file is using in android 5.0+). In mobile device, you can find it in:

/system/etc/fonts.xml (for 5.0+)

(For android 4.4 and below using this version, but I think that fonts.xml has a more clear format and easy to understand.)

For example,

The name attribute name='sans-serif' of family tag defined the value you can use in android:fontFamily.

The font tag define the corresponded font files.

In this case, you can ignore the source under <!-- fallback fonts -->, it's using for fonts' fallback logic.

GnodGnod

You can do it easy way by using following library

its light weight and easy to implement, just copy your fonts in asset folder and use name in xml.

Sanny NagvekerSanny Nagveker

try these simple steps.1. create font folder in res folder.2. copy and paste .ttf file into font folder.3. Now give the path in xml like below.

or what ever your file name is.Thats it happy code

Syed Danish HaiderSyed Danish Haider

I use Letter Press lib for my NonTextView stuff like Buttons and kianoni fontloader lib for my TextViews cause of usage of style in this lib is more easy than Letter Press for me and i got ideal feedback with that.this is great for those who want to use custom font except Roboto Font.so it was my experience with font libs.for those who want to use custom class for change font i highly recommended to create this class with this snippet

And use class like this :

maybe this help.

Ali Khaki
8921 gold badge7 silver badges20 bronze badges
SetmaxSetmax

For android-studio 3 and above you can use this style and then all textView font change in app.

create this style in your style.xml :

Then use it in your theme :

Ali KhakiAli Khaki
8921 gold badge7 silver badges20 bronze badges

The easiest way to add the font programatically to a TextView is to, first, add the font file in your Assets folder in the project. For example your font path is looking like this: assets/fonts/my_font.otf

And add it to a TextView as:

Kotlin

Java

pandabearpandabear
7911 gold badge8 silver badges19 bronze badges

You can also change standard fonts with setTextAppearance (requires API 16), see https://stackoverflow.com/a/36301508/2914140:

CoolMindCoolMind
6,3431 gold badge53 silver badges88 bronze badges

protected by CommunityJan 7 '17 at 13:11

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).
Would you like to answer one of these unanswered questions instead?

Not the answer you're looking for? Browse other questions tagged androidandroid-layouttextviewtypeface or ask your own question.