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 6660223
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T02:07:43+00:00 2026-05-26T02:07:43+00:00

I understand that to use custom fonts in a widget I need to render

  • 0

I understand that to use custom fonts in a widget I need to render the font to a bitmap, but how do I set a system typeface programmatically?

android:typeface="serif"

in XML is successful, but I cannot find a way to do this at run time.

I currently have

int fn = fullDate.length();
SpannableString dt = new SpannableString(fullDate);
dt.setSpan(new StyleSpan(Typeface.BOLD), 0, fn, 0);
remoteView.setTextViewText(R.id.dateText, dt);

Which works, but using, for example, Typeface.SERIF, gives The constructor StyleSpan(Typeface) is undefined

  • 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-05-26T02:07:43+00:00Added an answer on May 26, 2026 at 2:07 am

    The constructor for StyleSpan that you’re using takes in a constant defined in Typeface and not one of the fields. The constants available are

    Typeface.BOLD
    Typeface.BOLD_ITALIC
    Typeface.ITALIC
    Typeface.NORMAL
    

    If you want to set the typeface to a specific font, you need to use TextView.setTypeFace()

    EDIT
    This cannot be done for widgets since you only have access to the remote view. Others have circumvented this by passing an image to the remote view. See this question for details:
    How to use a custom typeface in a widget?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I understand that I need to use LoadLibrary(). But what other steps do I
I understand that when I use git pull --rebase , git will re-write history
I am completely new to LINQ in C#/.NET. I understand that I could use
I understand that it is good practice to use a using block when getting
I have a service that I am rewriting to use threading. I understand that
Why would you use .NET Remoting over WCF ? I understand that WCF has
Which algorithm does the JavaScript Array#sort() function use? I understand that it can take
I understsand that if I want to use authentication in WCF then I need
I understand that VUGen's web_set_timeout function allows me to set a timeout value higher
I have a bunch of java custom tags that use spring managed beans.. since

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.