Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
假设我们有两个屏幕尺寸相同但分辨率不同的安卓设备。以下是否正确:如果使用 dp 单位设置所有视图的大小,则两个屏幕将显示相同数量的内容,唯一的区别将是视图的清晰度。
如果屏幕具有相同的物理尺寸但具有不同的 dpi,并且您使用了 dp(与密度无关的像素),那么它们应该相同,因为这是 dp 单位的点。
此链接显示了有关屏幕尺寸处理和 dp 值推导的更多信息。
是的,dp(或 dip)表示与密度无关的像素。 来源
所以它与设备的像素密度无关。