I am trying to write an android application.
Therefore, I have a SurfaceView class that draws all objects.
Now, when, for example, I draw a circle, I must specify the size.
Is there a way to make this size depending on how large the screen resolution and density are?
Since 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 a radius of 50px, it will be larger on smaller screens than on large screens.
Any ideas?
EDIT: I know that when creating some layout I could use density pixels. But I do not work on layouts, I draw on top of the surface. when drawing something like
canvas.drawCircle(x, y, size, paint);
size declares a radius in a pixel. Is there a way to convert pixels to density pixels? Any method or simliar?
Thanks in advance
source
share