Saturday, May 19, 2012

Calculate DPI

http://jason1peng.blogspot.com/2011/08/android-dpi-px-dp.html
http://developer.android.com/guide/practices/screens_support.html#ConfigurationExamples

http://android-developers.blogspot.tw/2011/07/new-tools-for-managing-screen-sizes.html
http://saminjava.blogspot.tw/2013/09/android-px-dp-sp.html

px = dp * (dpi / 160)

px: pixel, physical
dp: dip, density-independent pixel (The virtual pixel unit normalized to a 160 dpi screen)
dpi: dot per inch

so, based on the equation, same dp, but in higher density, will have more pixel, but will have same length in real word... the base unit is chosen to be 160 dpi

160 dp = 1 inch (real world)











mdpi = 160 dpi



ex. 7" 1280x800

reference ==> 600dp: a 7” tablet (600x1024 mdpi).

Use short side for calculation (1280x800), it's width in portrait mode...
800 = 600*(dpi/160) ==> dpi = 213 (category as hdpi?)

And, actual pixels that shows on screen will be, 961x600

[Note] DP 可理解成 實際上在螢幕show 出的 image pixel 數...

[Note] http://blog.csdn.net/moruite/article/details/6028547
DPI(dot per inch) = 斜邊點數/螢幕尺吋

No comments:

Related Posts Plugin for WordPress, Blogger...