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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T00:11:39+00:00 2026-05-28T00:11:39+00:00

I know the PaintText on Canvas in android takes its size in a scalable

  • 0

I know the PaintText on Canvas in android takes its size in a scalable measurement, but strokeWidth for painting a line or something is exact pixel size… so, how do I calculate what my stroke width should be on screens with varying screen densities?

I know I could create a standard image and then just draw the image, and it would have its density taken care of by the OS, but this seems like overkill to me. Seems like there should be some simple method, and probably is, that says convert this true pixel amount relative to densixy X to the pixes size it should be for density Y… or better yet, just have the setStroke have an alternate that takes density into account. (I don’t see that, but that would be nice.)

How would I do this? Or does this exist and I am just overlooking it somewhere in the API?

  • 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-28T00:11:39+00:00Added an answer on May 28, 2026 at 12:11 am

    Define your densities in an xml using dimension.

    Then you can use getResources().getDimensionPixelSize(R.dimen.yourdensity) to get pixel value for the density and use it for strokewidth.

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

Sidebar

Related Questions

Know this might be rather basic, but I been trying to figure out how
I know that I can do something like $int = (int)99; //(int) has a
I know this might be a no-brainer, but please read on. I also know
I know, I would have thought the answer was obviously no as well, but
I know this sounds like a broad question but I can narrow it down
I'm doing something wrong, I know. I can't quite figure out how to link
I am trying to do something but I haven't found anything on google since
Im building my own android app, but im kinda stuck at the login part.
Anyone know of an API (php preferable but I'd be interested in any language)
from what I know, CTR mode doesn't use an Initial Vector. It just takes

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.