Hi,
I was reading multiple screen support page on SDK doc for solving a
pixel to dpi scaling problem in my app. In the doc, it says
"// Convert the dips to pixels
final float scale =
getContext().getResources().getDisplayMetrics().density;
mGestureThreshold = (int) (GESTURE_THRESHOLD_DIP * scale + 0.5f);"

My question is why we have to add 0.5f at the end? It indeed works
great on high density screen but failed to match the result on medium
density screen. For medium density screen, I have to remove the +0.5f.
In addition. according to the doc, px - dpi conversion works like px =
dpi x (density/160) and there is no mentioning of adding additional
0.5 at the end. Does anybody know why and how it works? Thanks.

-- 
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+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to