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

  • Home
  • SEARCH
  • 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 4075182
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T17:15:54+00:00 2026-05-20T17:15:54+00:00

For my Android game I have some calls to Canvas.drawText() . For testing, I

  • 0

For my Android game I have some calls to Canvas.drawText().

For testing, I use the standard font size which seems to be working fine.

However, when I bump up the resolution to a higher density, the larger images are automatically loaded but the text is now incredibly small.

Is there an easy way to calculate what size the text should be drawn at or am I bound to do this manually?

edit: What was the point of editing my post @Suragch ?

  • 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-20T17:15:55+00:00Added an answer on May 20, 2026 at 5:15 pm

    The easiest way is to define your font sizes in your resources with the units of scale-independent pixels (sp) — this unit is like density independent pixels (dp or dip) in that it takes into account the screen density but it also takes into account the font-size setting of the user.

    To add a new dimension create a dimens.xml file in your res/values folder and enter the following code to add a new dimension with the name myFontSize:

    <?xml version="1.0" encoding="utf-8"?>
    <resources>
        <dimen name="myFontSize">20sp</dimen>
    </resources>
    

    You can then get the text size in your application using

    int scaledSize = getResources().getDimensionPixelSize(R.dimen.myFontSize);
    

    The resulting size will be correctly scaled to take into account the current screen density and font-size setting.

    For more information see the Android Developers page on More Resources.

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

Sidebar

Related Questions

I have an android game where a ball moves based on the accelerometer. The
Have done some Android Dev in the past but it has been a while
I have a problem with my game here. I kind of don't understand how
I'm attempting to make a simple game of Pairs for Android. Program Structure Menu.java
I am making an android 2d game and ran into a problem. I made
I want to save my Android game state so the user can pick up
I am looking to create a very simple Android platform game. For this, I
Testing my game on a slower device (Orange San Francisco aka ZTE Blade) and
I have done this many times in different apps but this is my first
I'm developing a casual game. I'm bored to wait before my app is alive

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.