Question Detail

I want to change text Font-Family in android but I have no idea is Android provide any Default Font families. Please describe me is there any predefined Font in Android to use with TextView. 


Thread Reply

Bili Greed

- 1 years ago

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

android:fontFamily="sans-serif"           // roboto regular
android:fontFamily="sans-serif-light"     // roboto light
android:fontFamily="sans-serif-condensed" // roboto condensed
android:fontFamily="sans-serif-black"     // roboto black
android:fontFamily="sans-serif-thin"      // roboto thin (android 4.2)
android:fontFamily="sans-serif-medium"    // roboto medium (android 5.0)

enter image description here

in combination with

android:textStyle="normal|bold|italic"

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

fonts.xml

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <string name="font_family_light">sans-serif-light</string>
    <string name="font_family_medium">sans-serif-medium</string>
    <string name="font_family_regular">sans-serif</string>
    <string name="font_family_condensed">sans-serif-condensed</string>
    <string name="font_family_black">sans-serif-black</string>
    <string name="font_family_thin">sans-serif-thin</string>
</resources>

Anonymous

- 1 years ago

VBage Tech avatar

From android 4.1 / 4.2, the following Roboto font families are available:
   
  android:fontFamily="sans-serif" // roboto regular
  android:fontFamily="sans-serif-light" // roboto light
  android:fontFamily="sans-serif-condensed" // roboto condensed
  android:fontFamily="sans-serif-thin" // roboto thin (android 4.2)
  android:fontFamily="sans-serif-medium" // roboto medium (android 5.0)
  in combination with this
   
  android:textStyle="normal|bold|italic"
  12 variants are possible:
   
  Regular
  Italic
  Bold
  Bold-italic
  Light
  Light-italic
  Thin
  Thin-italic
  Condensed regular
  Condensed italic
  Condensed bold
  Condensed bold-italic
   
  Added in Android Jelly Bean (4.1) - API 16 :
   
  Regular (default):
   
  <item name="android:fontFamily">sans-serif</item>
  <item name="android:textStyle">normal</item>
  Italic:
   
  <item name="android:fontFamily">sans-serif</item>
  <item name="android:textStyle">italic</item>
  Bold:
   
  <item name="android:fontFamily">sans-serif</item>
  <item name="android:textStyle">bold</item>
  Bold-italic:
   
  <item name="android:fontFamily">sans-serif</item>
  <item name="android:textStyle">bold|italic</item>
  Light:
   
  <item name="android:fontFamily">sans-serif-light</item>
  <item name="android:textStyle">normal</item>
  Light-italic:
   
  <item name="android:fontFamily">sans-serif-light</item>
  <item name="android:textStyle">italic</item>
  Thin :
   
  <item name="android:fontFamily">sans-serif-thin</item>
  <item name="android:textStyle">normal</item>
  Thin-italic :
   
  <item name="android:fontFamily">sans-serif-thin</item>
  <item name="android:textStyle">italic</item>
  Condensed regular:
   
  <item name="android:fontFamily">sans-serif-condensed</item>
  <item name="android:textStyle">normal</item>
  Condensed italic:
   
  <item name="android:fontFamily">sans-serif-condensed</item>
  <item name="android:textStyle">italic</item>
  Condensed bold:
   
  <item name="android:fontFamily">sans-serif-condensed</item>
  <item name="android:textStyle">bold</item>
  Condensed bold-italic:
   
  <item name="android:fontFamily">sans-serif-condensed</item>
  <item name="android:textStyle">bold|italic</item>
  Added in Android Lollipop (v5.0) - API 21 :
   
  Medium:
   
  <item name="android:fontFamily">sans-serif-medium</item>
  <item name="android:textStyle">normal</item>
  Medium-italic:
   
  <item name="android:fontFamily">sans-serif-medium</item>
  <item name="android:textStyle">italic</item>
  Black:
   
  <item name="android:fontFamily">sans-serif-black</item>
  <item name="android:textStyle">italic</item>
  For quick reference, this is how they all look like: