is dp really device independent?

て烟熏妆下的殇ゞ 提交于 2020-02-06 04:07:48

问题


This sounds stupid , but I have confusion. I have defined a layout which have a stripe of images . Strip height is set as some x dp. But I can see difference in height , in difference phones (in samsung note2 it looks bigger than nexus 4). Can someone explain or provide some useful links ?

Thanks in advance.


回答1:


FYI, DP stands for Density independent pixel.

And Here is definition of Screen density:

Screen density

The quantity of pixels within a physical area of the screen; usually referred to as dpi (dots per inch). For example, a "low" density screen has fewer pixels within a given physical area, compared to a "normal" or "high" density screen.

Reference: http://developer.android.com/guide/practices/screens_support.html




回答2:


These may help:

What is the difference between "px", "dp", "dip" and "sp" on Android?

http://developer.android.com/guide/practices/screens_support.html




回答3:


The mdpi, hdpi, xhdpi, ... suffixes stands for generalized densities.

That means that 2 xhdpi phones might have slightly different real densities.

For example, Galaxy Nexus and Galaxy SIII are both noted as xhdpi, but Galaxy Nexus has a 316ppi screen, whereas Galaxy SIII screen is a 306ppi

source: Wikipedia



来源:https://stackoverflow.com/questions/15879077/is-dp-really-device-independent

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!