There's a very simple yet effective way to do it, you can declare all
your sizes in a dimen file for each specific density/size, as you usually
do for layouts e.g:
values/dimens.xml <--- With default sizes
values-sw600dp/dimens.xml <-- Tablets sizes
Now before you start drawing, load all the values in your program only
once, maybe onCreate of your drawing activity, using the following
float someItemSize =
That way, you let the operating system do the pixels conversion for you,
you should do it only once and most important, this will give alot of
flexibility to your code because you will be able to change sizes from xml
files without even touching your actual code, hence, the customization
should be easier as well as future changes...
Hope it helps!