Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8902173
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T01:32:46+00:00 2026-06-15T01:32:46+00:00

I have developed one android project. In this project the text font defaults to

  • 0

I have developed one android project. In this project the text font defaults to android:sans.

Now I want to replace the default text font to roboto font for my entire project.

How can I do this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T01:32:48+00:00Added an answer on June 15, 2026 at 1:32 am

    You can download the Roboto font from here:
    https://fonts.google.com/specimen/Roboto. [Updated 2020-01-28]

    You can do it the conventional way by using TypeFace, like this:

    Typeface typeface = Typeface.createFromAsset(getAssets(), fontName);
    textView.setTypeface(typeface);
    

    Note: The above will have to be done in every Activity.

    Alternatively, if, for example, you want to apply the Roboto font to all the TextViews in your application, then you will need to create your own widget that extends TextView.

    There is a simple way of doing this. Follow the steps from this answer on SO: https://stackoverflow.com/a/9199258/450534 (full props to leocadiotine for the solution. I have used it before and it works like a charm)

    EDIT: Think of your_namespace as a marker for you to give it a name of your choice. For example, when integrating Admob in XML, I use xmlns:ads. You can use, for example: xmlns:font or something descriptive.

    As for what the custom.ttf stands for, it is basically the font file with its extension that you need to copy in your Assets folder. For example, if you are using ROBOTO-REGULAR.TTF, then replace the custom.ttf with ROBOTO-REGULAR.TTF. Using this example, the entire code should look this this:

    <your.package.widget.TypefacedTextView
        xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:font="http://schemas.android.com/apk/res/your.package"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:text="Custom fonts in XML are easy"
        android:textColor="#FFF"
        android:textSize="14dip"
        font:typeface="ROBOTO-REGULAR.TTF" />
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

in my project i have one registration form which is developed in C#.net.to this
I have developed one Android app in one project with Eclipse - it's structured
I have one project with is developed in Php and javascript. How to open
I have a project which has gui consisting of three buttons.Now one of these
I have developed one application which is running properly in android 4.0(icecream Sandwhich) but
I have developed an Android app which I want to be available both as
We have developed one android application which will send the request and receive the
m anew comer to iPhone...before i have developed for Android..Could any one tell me
Possible Duplicate: bitmap size exceeds Vm budget error android I have developed one android
We are a lead generating company and have developed one application where our customers

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.