I have defined a circle radius dimension in a resources file like so:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<dimen name="circleRadius">15dp</dimen>
</resources>
And then I draw the circle in a custom View like this:
Resources res = getResources();
float radius = res.getDimension(R.dimen.circleRadius);
...
canvas.drawCircle(randomX, randomY, radius, paint);
I was under the impression that this would produce a circle of the same physical size on any device, because the units are specified in dp, but it doesn't. See the screenshots below.
Device 1 (skin=WVGA800, density=240):
Device 2 (skin=QVGA, density=120):
Device 3 (skin=1024x768, density=160):
For each device, I ticked the Scale display to real size
option when launching, and used the same settings (screen size=3.7 in, monitor dpi=105). Is this where I've gone wrong? Is there something I am not understanding?