I want to provide an easy way to understand dp
. In fact, I think dp
is the easiest one to understand. dp
is just a physical length unit. It's of the same dimension as mm
or inch
. It's just convenient for us to write 50dp
, 60dp
rather than 50/160 inch
or 60/160 inch
, because one dp
is just 1/160 inch
whatever the screen size or resolution is.
The only problem is that, the android dpi of some screens are not accurate. For example, a screen classified to 160dpi may have 170dpi indeed. So the computation result of dp
is fuzzy. It should be approximately the same as 1/160 inch
.