mcfly soft
mcfly soft

Reputation: 11665

custom view with objects on screens with different screensize and pixel density

I would like to draw a circle in my custom view and it should appear nearly the same size on any screenresolution and density.

for example if I would draw the circle with a radius of 50 pixel, then it appears large on a screen with low resolution. But on a high resolution screen it appears small.

My first try was to simply calculate the size depending on the screensize. BUT on a small device with a very high resolution the circle looks too small. I guess I can't manage the pixeldensity.

How would you solve my problem ?

regards

Upvotes: 0

Views: 640

Answers (1)

vokilam
vokilam

Reputation: 10323

You can access screen density via DisplayMetrics as described here How to define a pixel independent height in an onDraw() method

Upvotes: 1

Related Questions