I’ve been following the best practices for creating layouts for differing screen sizes as per this guide: http://developer.android.com/guide/practices/screens_support.html
I’ve now come to doing some drawing work using methods of the Canvas class:
eg. canvas.drawLine(60, 320, 120, 320, linePaint);
Can any one help with how I am supposed to make those pixel values (60/120/etc) in to density pixels so that the line is scaled correctly? Otherwise the line will not appear as I intend, it’ll be too far down and too long on smaller screens for example.
Thanks for any replies.
Answer
I missed it the first time going through the Android document; the necessary info is in section “3. Do not use hard-coded pixel values in your code” of the link in my original post.