• Skip to main content
  • Skip to secondary menu
  • Skip to primary sidebar
  • Skip to footer
  • Home
  • About
  • Projects
    • GStaticMap WP Plugin
  • Contact
  • Privacy Policy

Lorenz Blog

All About Web & Mobile Application Development

  • Featured Articles
  • Gadgets
    • Android
    • Blackberry
  • Programming
    • Android
    • PHP
    • Java Script
    • MySQL
    • Postgresql
    • Flex
    • Web
  • Software
    • Mac OS
    • Windows
    • Linux
  • Web
You are Here » Home >> Information Technology >> Programming >> Android >> Coding Tips: How to Use Custom Font in Android

Coding Tips: How to Use Custom Font in Android

September 26, 2011 by Lorensius Londa 1 Comment

If you are new to Android development and wondering how to use custom font, here is a quick tip to use custom font in your Android application. Using custom font in Android is pretty simple, just copy the custom font files  and load them from your application.

  • Copy your custom font files into assets directory. The font files can be a True Type (ttf) font or Open Type font (.otf)custom font android
  • From your application code, load the font using Typeface.createFromAsset(getAssets(), “fontname.otf”) method
    Typeface font = Typeface.createFromAsset(getAssets(), "helvetica.otf");
    
  • To use the loaded custom font, use setTypeface method on the widget you want to apply, for example, to use it on TextView, use textViewObj.setTypeface(customfont).
    TextView myTextView = (TextView) findViewById(R.id.tv_mytext);
    
    myTextView.setTypeface(font);
    
Facebooktwitterredditpinterestlinkedinmailby feather

Related posts:

  1. Coding Tips: How to Use Custom Transition Animation in Android
  2. Android Coding Tips: How to Create Options Menu on Child Activity inside an ActivityGroup
  3. How to Create Custom Window Title in Android
  4. Android Tips: How to Place Image or Logo at The Center of Actionbar

Filed Under: Android, Programming Tagged With: Android, android customfont, android open type, android true type, custom font

About Lorensius Londa

Passionate web and mobile application developer. Co-founder of TRUSTUDIO, loves programming, Android, aviation, travelling, photography, coffee and gym mania.

Reader Interactions

Comments

  1. Vishal says

    November 20, 2011 at 1:53 pm

    How to apply font to all controls….

    Reply

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Primary Sidebar

About Me

A husband, father of two, passionate software developer, diy lover and home baker who loves to learn new things. Read More…

  • Facebook
  • GitHub
  • Google+
  • Instagram
  • Twitter
  • YouTube

Featured Articles

How to Setup MQTT Server Using Mosquitto and Libwebsocket on Freebsd

Blue Bamboo P25 Printer Android Demo Application With Source Code

Simple JSON RPC Client for Android

How to Send Message to Google Cloud Messaging (GCM) Server Using JSON and PHP

Footer

Recent Comments

  • Aditya Dabas on About
  • Ayten Göksenin Barutçu on How to Make Android Map Scrollable Inside a ScrollView Layout
  • mang jojot on About
  • Hussain on How to Programmatically Scan or Discover Android Bluetooth Devices

Recent Posts

  • How to Fix Blank Screen on WordPress Add/Edit Post Page
  • How to Programmatically Restart the ESP32 Board
  • How to Get Hardware Info of ESP32
  • How to Setup MQTT Server Using Mosquitto and Libwebsocket on Freebsd

Latest Tweets

  • @tricahyono_bowo @infobandung @infobdg Wah kejauhan om 355 days ago
  • Wilujeng enjing sadayana..Mohon info tempat powder coating dan sandblasting yg recommended di Bandung dunk @infobandung @infobdg359 days ago

Copyright © 2023 · Magazine Pro on Genesis Framework · WordPress · Log in