谷歌地图上的预测参考说:
屏幕位置是相对于地图左上角(不一定是整个屏幕)的屏幕像素(不是显示像素)。
屏幕像素和显示像素有什么区别?官方文档也没有回答这个问题。
例如,Retina Display 小工具的像素非常小,因此 " 1sp
" (sp = 屏幕像素) 的宽度会非常小。“ ” 的宽度1dp
在 Retina Display 小工具和大像素屏幕中看起来是一样的。
The main difference between sp and dp is that the size of each dp is scaled depending on the pixel density of the device, while sp is also scaled but takes into account of the user's font size. You would use the unit dp to make sure your layouts look the same across devices with different pixel densities. Screen pixels are mostly used just for font sizes.
Check here for more information about the different types of units.