问题
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