Tuesday, October 29, 2013

[android-developers] Re: getDensity returning 0 in attempt to create pixel density independant controls

Don't use the Canvas' density, use the Display's. 

On Tuesday, October 29, 2013 2:54:28 PM UTC+2, firebreather wrote:
i'm attempting to draw pixel density and resolution independent controls to the screen for my game.
 
 if I use screenWidth in declaring the size, the control's size will vary with resolution. if I just use a certain number of pixels, the control size will vary with pixel density.
 
assume i need canvas.getDensity(), as there is no action like
 

canvas.drawCircle(cx,cy,60di,paint). //di: density independent pixel

canvas.getDensity() is returning 0, however. I saw on a different post a suggestion of disabling the GPU to fix this. I don't want to disable the GPU on my user's phones' though, even if I knew how. how do I get around this?

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
---
You received this message because you are subscribed to the Google Groups "Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to android-developers+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate