Drawing shapes in different sizes depending on resolution

user2410644

I am trying to write an app for android.
Therefore I've got a SurfaceView class drawing all objects.

Now, when for instance I'm drawing a circle, I have to specify a size.
Is there a way making this size depending on how big the screen resolution and density is?
Becausei when drawing a circle, I want it to be the same size on a lower resolution device as on a high resolution device.

When drawing a circle with 50px radius, it would be bigger on smaller screens than on bigger screens.

Any ideas?

EDIT: I know when creating some layout i could use density-pixels. But I am not working on layouts, i am drawing on top of a surfaceview. when drawing something like

canvas.drawCircle(x, y, size, paint);

size declares the radius in pixel. Is there a way to convert pixels into density pixels? Any method or simliar?

Thanks in advance

Nantoka

I think the formula you are looking for (dip -> px) is published here:

What is the correct way to specify dimensions in DIP from Java code?

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Drawing shapes in different sizes depending on resolution

From Dev

Android Fresco: drawing different kind of image shapes

From Dev

Why are windows different sizes on screens with the same resolution?

From Dev

Map drawing tablet to different screen sizes

From Dev

PDFBox: Draws images in different locations and sizes depending on input PDF

From Dev

How to set different font sizes depending on the screen size in Angular Material?

From Dev

What is a good approach for scaling/drawing images for different screen sizes?

From Dev

Drawing circles on canvas so they are equal or at least comparable sizes on different devices

From Dev

Show different first active Bootstrap tab-pane depending on the resolution

From Dev

Drawing different colors of circles depending if a number exists in a variable or not

From Dev

Drawing multiple shapes in OpenGL

From Dev

Drawing shapes in css responsively

From Dev

Drawing Shapes as values on ZingChart

From Dev

Android: Drawing custom shapes

From Dev

Drawing shapes as textures in LibGDX

From Dev

Drawing shapes over an ImagePanel

From Dev

How to drawing a shapes in QtextEdit

From Dev

PaintComponent not working for drawing shapes

From Dev

Drawing curved shapes

From Dev

Drawing shapes inside XAML?

From Dev

Drawing shapes in python (turtle)

From Dev

Drawing and filling in shapes

From Dev

Drawing Layered Shapes

From Dev

Drawing shapes on a JForm java

From Dev

Different button sizes depending on which unit I'm using. Why?

From Dev

Calculate UILabel height depending on text Length for different screen sizes inside UITableView Cell

From Dev

What are the screen resolution sizes for android sizes

From Dev

Drawing to a SurfaceView is low resolution

From Dev

Drawing shapes and images in libgdx dialog

Related Related

  1. 1

    Drawing shapes in different sizes depending on resolution

  2. 2

    Android Fresco: drawing different kind of image shapes

  3. 3

    Why are windows different sizes on screens with the same resolution?

  4. 4

    Map drawing tablet to different screen sizes

  5. 5

    PDFBox: Draws images in different locations and sizes depending on input PDF

  6. 6

    How to set different font sizes depending on the screen size in Angular Material?

  7. 7

    What is a good approach for scaling/drawing images for different screen sizes?

  8. 8

    Drawing circles on canvas so they are equal or at least comparable sizes on different devices

  9. 9

    Show different first active Bootstrap tab-pane depending on the resolution

  10. 10

    Drawing different colors of circles depending if a number exists in a variable or not

  11. 11

    Drawing multiple shapes in OpenGL

  12. 12

    Drawing shapes in css responsively

  13. 13

    Drawing Shapes as values on ZingChart

  14. 14

    Android: Drawing custom shapes

  15. 15

    Drawing shapes as textures in LibGDX

  16. 16

    Drawing shapes over an ImagePanel

  17. 17

    How to drawing a shapes in QtextEdit

  18. 18

    PaintComponent not working for drawing shapes

  19. 19

    Drawing curved shapes

  20. 20

    Drawing shapes inside XAML?

  21. 21

    Drawing shapes in python (turtle)

  22. 22

    Drawing and filling in shapes

  23. 23

    Drawing Layered Shapes

  24. 24

    Drawing shapes on a JForm java

  25. 25

    Different button sizes depending on which unit I'm using. Why?

  26. 26

    Calculate UILabel height depending on text Length for different screen sizes inside UITableView Cell

  27. 27

    What are the screen resolution sizes for android sizes

  28. 28

    Drawing to a SurfaceView is low resolution

  29. 29

    Drawing shapes and images in libgdx dialog

HotTag

Archive